GeoJsonSource

GeoJson source, allows using FeatureCollections from Json.

See also

Constructors

Link copied to clipboard
constructor(id: String?)

Create an empty GeoJsonSource

constructor(id: String?, options: GeoJsonOptions?)

Create an empty GeoJsonSource with non-default GeoJsonOptions.

constructor(id: String?, geoJson: String?)

Create a GeoJsonSource from a raw json string

constructor(id: String?, geoJson: String?, options: GeoJsonOptions?)

Create a GeoJsonSource from a raw json string and non-default GeoJsonOptions

constructor(id: String?, url: URL)

Create a GeoJsonSource from a remote geo json file

constructor(id: String?, url: URL, options: GeoJsonOptions?)

Create a GeoJsonSource from a remote geo json file and non-default GeoJsonOptions

constructor(id: String?, uri: URI)

Create a GeoJsonSource from a geo json URI

constructor(id: String?, uri: URI, options: GeoJsonOptions?)

Create a GeoJsonSource from a geo json URI and non-default GeoJsonOptions

constructor(id: String?, features: FeatureCollection?)

Create a GeoJsonSource from a FeatureCollection.

constructor(id: String?, features: FeatureCollection?, options: GeoJsonOptions?)

Create a GeoJsonSource from a FeatureCollection and non-default GeoJsonOptions.

constructor(id: String?, feature: Feature?)

Create a GeoJsonSource from a Feature

constructor(id: String?, feature: Feature?, options: GeoJsonOptions?)

Create a GeoJsonSource from a Feature and non-default GeoJsonOptions

constructor(id: String?, geometry: Geometry?)

Create a GeoJsonSource from a Geometry

constructor(id: String?, geometry: Geometry?, options: GeoJsonOptions?)

Create a GeoJsonSource from a Geometry and non-default GeoJsonOptions

Properties

Link copied to clipboard
Link copied to clipboard
val uri: String?

Get the URI of the source.

Link copied to clipboard
var url: String?

Functions

Link copied to clipboard

Retrieve the source attribution.

Link copied to clipboard
fun getClusterChildren(cluster: Feature): FeatureCollection

Returns the children of a cluster (on the next zoom level) given its id (cluster_id value from feature properties).

Link copied to clipboard
fun getClusterExpansionZoom(cluster: Feature): Int

Returns the zoom on which the cluster expands into several children (useful for "click to zoom" feature) given the cluster's cluster_id (cluster_id value from feature properties).

Link copied to clipboard
fun getClusterLeaves(cluster: Feature, limit: Long, offset: Long): FeatureCollection

Returns all the leaves of a cluster (given its cluster_id), with pagination support: limit is the number of leaves to return (set to Infinity for all points), and offset is the amount of points to skip (for pagination).

Link copied to clipboard
open fun getId(): String

Retrieve the source id

Link copied to clipboard

Retrieve current maximum overscale factor for parent tiles.

Link copied to clipboard

Retrieve the minimum tile update interval, which is used to throttle the tile update network requests.

Link copied to clipboard

Retrieve current pre-fetching zoom delta.

Link copied to clipboard

Retrieve whether or not the fetched tiles for the given source should be stored in the local cache

Link copied to clipboard
fun querySourceFeatures(filter: Expression?): List<Feature>

Queries the source for features.

Link copied to clipboard
open fun setDetached()
Link copied to clipboard
fun setGeoJson(json: String)
fun setGeoJson(featureCollection: FeatureCollection?)

Updates the GeoJson. The update is performed asynchronously, so the data won't be immediately visible or available to query when this method returns.

fun setGeoJson(feature: Feature?)

Updates the GeoJson with a single feature. The update is performed asynchronously, so the data won't be immediately visible or available to query when this method returns.

fun setGeoJson(geometry: Geometry?)

Updates the GeoJson with a single geometry. The update is performed asynchronously, so the data won't be immediately visible or available to query when this method returns.

Link copied to clipboard
open fun setMaxOverscaleFactorForParentTiles(@Nullable maxOverscaleFactor: Int?)

When a set of tiles for a current zoom level is being rendered and some of the ideal tiles that cover the screen are not yet loaded, parent tile could be used instead. This might introduce unwanted rendering side-effects, especially for raster tiles that are overscaled multiple times. This method sets the maximum limit for how much a parent tile can be overscaled.

Link copied to clipboard

Sets the minimum tile update interval, which is used to throttle the tile update network requests.

Link copied to clipboard
open fun setPrefetchZoomDelta(@Nullable delta: Int?)

Set the tile pre-fetching zoom delta for current source. Pre-fetching makes sure that a low-resolution tile at the (current_zoom_level - delta) is rendered as soon as possible at the expense of a little bandwidth. If delta has not been set or set to null, it will use the value in MapLibreMap instance.

Link copied to clipboard
fun setUri(uri: URI)
fun setUri(uri: String?)

Updates the URI of the source.

Link copied to clipboard
fun setUrl(url: URL)

Updates the url

Link copied to clipboard
open fun setVolatile(value: Boolean)

Set a flag defining whether or not the fetched tiles for the given source should be stored in the local cache