GeoJsonLayer

open class GeoJsonLayer : Layer

A class that allows the developer to import GeoJSON data, style it and interact with the imported data.

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();

Constructors

Link copied to clipboard
constructor(map: GoogleMap, geoJsonFile: JSONObject, markerManager: MarkerManager, polygonManager: PolygonManager, polylineManager: PolylineManager, groundOverlayManager: GroundOverlayManager)
Creates a new GeoJsonLayer object.
constructor(map: GoogleMap, resourceId: Int, context: Context, markerManager: MarkerManager, polygonManager: PolygonManager, polylineManager: PolylineManager, groundOverlayManager: GroundOverlayManager)
Creates a new GeoJsonLayer object.
constructor(map: GoogleMap, geoJsonFile: JSONObject)
Creates a new GeoJsonLayer object.
constructor(map: GoogleMap, resourceId: Int, context: Context)
Creates a new GeoJsonLayer object.

Functions

Link copied to clipboard
open fun addFeature(feature: GeoJsonFeature)
Adds a GeoJsonFeature to the layer.
Link copied to clipboard
open fun addLayerToMap()
Adds all the GeoJsonFeature objects parsed from the given GeoJSON data onto the map
Link copied to clipboard
open fun getBoundingBox(): LatLngBounds
Gets the LatLngBounds containing the coordinates of the bounding box for the FeatureCollection.
Link copied to clipboard
open fun getContainerFeature(mapObject: Any): Feature
Link copied to clipboard
Gets the default style used to render GeoJsonLineStrings.
Link copied to clipboard
Gets the default style used to render GeoJsonPoints.
Link copied to clipboard
Gets the default style used to render GeoJsonPolygons.
Link copied to clipboard
open fun getFeature(mapObject: Any): Feature
Retrieves a corresponding Feature instance for the given Object Allows maps with multiple layers to determine which layer the Object belongs to.
Link copied to clipboard
Gets an iterable of all Feature elements that have been added to the layer
Link copied to clipboard
open fun getMap(): GoogleMap
Gets the map on which the layer is rendered
Link copied to clipboard
open fun isLayerOnMap(): Boolean
Checks if the current layer has been added to the map
Link copied to clipboard
open fun removeFeature(feature: GeoJsonFeature)
Removes the given GeoJsonFeature from the layer
Link copied to clipboard
Removes all the data from the map and clears all the stored placemarks
Link copied to clipboard
open fun setMap(map: GoogleMap)
Renders the layer on the given map.
Link copied to clipboard
Sets a single click listener for the entire GoogleMap object, that will be called with the corresponding Feature object when an object on the map (Polygon, Marker, Polyline) is clicked.
Link copied to clipboard
open fun toString(): String