public class GeoJsonLayer extends Layer
To create a new GeoJsonLayer from a resource stored locally
GeoJsonLayer layer = new GeoJsonLayer(getMap(), R.raw.resource,
getApplicationContext());
To render the imported GeoJSON data onto the layer
layer.addLayerToMap();
To remove the rendered data from the layer
layer.removeLayerFromMap();
Modifier and Type | Class and Description |
---|---|
static interface |
GeoJsonLayer.GeoJsonOnFeatureClickListener |
Layer.OnFeatureClickListener
Constructor and Description |
---|
GeoJsonLayer(GoogleMap map,
int resourceId,
android.content.Context context)
Creates a new GeoJsonLayer object.
|
GeoJsonLayer(GoogleMap map,
int resourceId,
android.content.Context context,
MarkerManager markerManager,
PolygonManager polygonManager,
PolylineManager polylineManager,
GroundOverlayManager groundOverlayManager)
Creates a new GeoJsonLayer object.
|
GeoJsonLayer(GoogleMap map,
org.json.JSONObject geoJsonFile)
Creates a new GeoJsonLayer object.
|
GeoJsonLayer(GoogleMap map,
org.json.JSONObject geoJsonFile,
MarkerManager markerManager,
PolygonManager polygonManager,
PolylineManager polylineManager,
GroundOverlayManager groundOverlayManager)
Creates a new GeoJsonLayer object.
|
Modifier and Type | Method and Description |
---|---|
void |
addFeature(GeoJsonFeature feature)
Adds a GeoJsonFeature to the layer.
|
void |
addLayerToMap()
Adds all the GeoJsonFeature objects parsed from the given GeoJSON data onto the map
|
LatLngBounds |
getBoundingBox()
Gets the LatLngBounds containing the coordinates of the bounding box for the
FeatureCollection.
|
java.lang.Iterable<GeoJsonFeature> |
getFeatures()
Gets an iterable of all Feature elements that have been added to the layer
|
void |
removeFeature(GeoJsonFeature feature)
Removes the given GeoJsonFeature from the layer
|
java.lang.String |
toString() |
addFeature, addGeoJsonToMap, addKMLToMap, getContainerFeature, getContainers, getDefaultLineStringStyle, getDefaultPointStyle, getDefaultPolygonStyle, getFeature, getGroundOverlays, getMap, hasContainers, hasFeatures, isLayerOnMap, removeFeature, removeLayerFromMap, setMap, setOnFeatureClickListener, storeRenderer
public GeoJsonLayer(GoogleMap map, org.json.JSONObject geoJsonFile, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager)
map
- map where the layer is to be renderedgeoJsonFile
- GeoJSON data to add to the layermarkerManager
- marker manager to create marker collection frompolygonManager
- polygon manager to create polygon collection frompolylineManager
- polyline manager to create polyline collection fromgroundOverlayManager
- ground overlay manager to create ground overlay collection frompublic GeoJsonLayer(GoogleMap map, int resourceId, android.content.Context context, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager) throws java.io.IOException, org.json.JSONException
map
- map where the layer is to be renderedresourceId
- GeoJSON file to add to the layercontext
- context of the application, required to open the GeoJSON filemarkerManager
- marker manager to create marker collection frompolygonManager
- polygon manager to create polygon collection frompolylineManager
- polyline manager to create polyline collection fromgroundOverlayManager
- ground overlay manager to create ground overlay collection fromjava.io.IOException
- if the file cannot be open for readorg.json.JSONException
- if the JSON file has invalid syntax and cannot be parsed successfullypublic GeoJsonLayer(GoogleMap map, org.json.JSONObject geoJsonFile)
map
- map where the layer is to be renderedgeoJsonFile
- GeoJSON data to add to the layerpublic GeoJsonLayer(GoogleMap map, int resourceId, android.content.Context context) throws java.io.IOException, org.json.JSONException
map
- map where the layer is to be renderedresourceId
- GeoJSON file to add to the layercontext
- context of the application, required to open the GeoJSON filejava.io.IOException
- if the file cannot be open for readorg.json.JSONException
- if the JSON file has invalid syntax and cannot be parsed successfullypublic void addLayerToMap()
addLayerToMap
in class Layer
public java.lang.Iterable<GeoJsonFeature> getFeatures()
getFeatures
in class Layer
public void addFeature(GeoJsonFeature feature)
feature
- GeoJsonFeature to add to the layerpublic void removeFeature(GeoJsonFeature feature)
feature
- feature to removepublic LatLngBounds getBoundingBox()
public java.lang.String toString()
toString
in class java.lang.Object