Builder

Builder for GeoJsonSource.

class Builder(sourceId: String, onGeoJsonParsed: OnGeoJsonParsed)

Parameters

onGeoJsonParsed

callback invoked when data is parsed

sourceId

the ID of the source

Constructors

Builder
Link copied to clipboard

the ID of the source

fun Builder(sourceId: String, onGeoJsonParsed: OnGeoJsonParsed)

Functions

attribution
Link copied to clipboard

Contains an attribution to be displayed when the map is shown to a user.

fun attribution(value: Expression): GeoJsonSource.Builder
fun attribution(value: String): GeoJsonSource.Builder
buffer
Link copied to clipboard

Size of the tile buffer on each side. A value of 0 produces no buffer. A value of 512 produces a buffer as wide as the tile itself. Larger values produce fewer rendering artifacts near tile edges and slower performance.

fun buffer(value: Expression): GeoJsonSource.Builder
fun buffer(value: Long): GeoJsonSource.Builder
build
Link copied to clipboard

Build the GeoJsonSource.

fun build(): GeoJsonSource
cluster
Link copied to clipboard

If the data is a collection of point features, setting this to true clusters the points by radius into groups. Cluster groups become new Point features in the source with additional properties:

  • cluster Is true if the point is a cluster

  • cluster_id A unqiue id for the cluster to be used in conjunction with the cluster inspection methods

  • point_count Number of original points grouped into this cluster

  • point_count_abbreviated An abbreviated point count

fun cluster(value: Expression): GeoJsonSource.Builder
fun cluster(value: Boolean): GeoJsonSource.Builder
clusterMaxZoom
Link copied to clipboard

Max zoom on which to cluster points if clustering is enabled. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered). Clusters are re-evaluated at integer zoom levels so setting clusterMaxZoom to 14 means the clusters will be displayed until z15.

fun clusterMaxZoom(value: Expression): GeoJsonSource.Builder
fun clusterMaxZoom(value: Long): GeoJsonSource.Builder
clusterProperties
Link copied to clipboard

An object defining custom properties on the generated clusters if clustering is enabled, aggregating values from clustered points. Has the form {"property_name": [operator, map_expression]}. operator is any expression function that accepts at least 2 operands (e.g. "+" or "max") — it accumulates the property value from clusters/points the cluster contains; map_expression produces the value of a single point.

Example: {"sum": ["+", ["get", "scalerank"]]}.

For more advanced use cases, in place of operator, you can use a custom reduce expression that references a special ["accumulated"] value, e.g.: {"sum": [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]]}

fun clusterProperties(value: Expression): GeoJsonSource.Builder
fun clusterProperties(value: HashMap<String, Any>): GeoJsonSource.Builder
clusterProperty
Link copied to clipboard

An object defining custom properties on the generated clusters if clustering is enabled, aggregating values from clustered points. Has the form {"property_name": [operator, map_expression]}. operator is any expression function that accepts at least 2 operands (e.g. "+" or "max") — it accumulates the property value from clusters/points the cluster contains; map_expression produces the value of a single point.

Example: {"sum": ["+", ["get", "scalerank"]]}.

For more advanced use cases, in place of operator, you can use a custom reduce expression that references a special ["accumulated"] value, e.g.: {"sum": [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]]}

fun clusterProperty(propertyName: String, mapExpr: Expression): GeoJsonSource.Builder
fun clusterProperty(propertyName: String, operatorExpr: Expression, mapExpr: Expression): GeoJsonSource.Builder
clusterRadius
Link copied to clipboard

Radius of each cluster if clustering is enabled. A value of 512 indicates a radius equal to the width of a tile.

fun clusterRadius(value: Expression): GeoJsonSource.Builder
fun clusterRadius(value: Long): GeoJsonSource.Builder
data
Link copied to clipboard

A URL to a GeoJSON file, or inline GeoJSON.

fun data(value: Expression): GeoJsonSource.Builder
fun data(value: String): GeoJsonSource.Builder
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
feature
Link copied to clipboard

Add a Feature to the GeojsonSource.

fun feature(value: Feature): GeoJsonSource.Builder
featureCollection
Link copied to clipboard

Add a FeatureCollection to the GeojsonSource.

fun featureCollection(value: FeatureCollection): GeoJsonSource.Builder
geometry
Link copied to clipboard

Add a Geometry to the GeojsonSource.

fun geometry(value: Geometry): GeoJsonSource.Builder
hashCode
Link copied to clipboard
open override fun hashCode(): Int
lineMetrics
Link copied to clipboard

Whether to calculate line distance metrics. This is required for line layers that specify line-gradient values.

fun lineMetrics(value: Expression): GeoJsonSource.Builder
fun lineMetrics(value: Boolean): GeoJsonSource.Builder
maxzoom
Link copied to clipboard

Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels).

fun maxzoom(value: Expression): GeoJsonSource.Builder
fun maxzoom(value: Long): GeoJsonSource.Builder
prefetchZoomDelta
Link copied to clipboard

When loading a map, if PrefetchZoomDelta is set to any number greater than 0, the map will first request a tile for zoom - delta in a attempt to display a full map at lower resolution as quick as possible. It will get clamped at the tile source minimum zoom. The default delta is 4.

fun prefetchZoomDelta(value: Expression): GeoJsonSource.Builder
fun prefetchZoomDelta(value: Long): GeoJsonSource.Builder
tolerance
Link copied to clipboard

Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance).

fun tolerance(value: Expression): GeoJsonSource.Builder
fun tolerance(value: Double): GeoJsonSource.Builder
toString
Link copied to clipboard
open override fun toString(): String
url
Link copied to clipboard

A URL to a GeoJSON file, or inline GeoJSON.

fun url(value: Expression): GeoJsonSource.Builder
fun url(value: String): GeoJsonSource.Builder

Properties

sourceId
Link copied to clipboard

the ID of the source

val sourceId: String