GeoJSONSourceDescriptor

data class GeoJSONSourceDescriptor(val id: String, var url: String? = null, var metadataUrl: String? = null, var minZoom: Float? = null, var maxZoom: Float? = null, var bounds: LatLonBounds? = null, var tileSize: TileSize? = null, var attribution: String? = null, var authenticator: XweatherAuthenticator? = null, var bundledAssetPath: String? = null) : SourceDescriptor

Configuration for a GeoJSON-backed source. At runtime, com.xweather.mapsgl.map.MapController.addSource creates a com.xweather.mapsgl.sources.GeoJSONSource; use com.xweather.mapsgl.map.MapController.getSource and cast to that type to set com.xweather.mapsgl.sources.GeoJSONSource.data or adjust com.xweather.mapsgl.sources.GeoJSONSource.url after registration.

Provide GeoJSON in one of three ways:

  1. bundledAssetPath — path under the host app's src/main/assets/ (loaded on com.xweather.mapsgl.map.MapController.addSource).

  2. Assign com.xweather.mapsgl.sources.GeoJSONSource.data after addSource (inline JSON via com.mapbox.geojson.FeatureCollection.fromJson, or an asset path via com.xweather.mapsgl.sources.GeoJSONSource.parseJsonOrAsset).

  3. url — remote GeoJSON endpoint template.

Constructors

Link copied to clipboard
constructor(id: String)

In-memory GeoJSON only — set com.xweather.mapsgl.sources.GeoJSONSource.data after com.xweather.mapsgl.map.MapController.addSource. Prefer this constructor over default-arg GeoJSONSourceDescriptor(id = …) when linking against a minified AAR.

constructor(id: String, bundledAssetPath: String)

Loads GeoJSON from bundledAssetPath under the host app's src/main/assets/ when the source is added. Example: GeoJSONSourceDescriptor("countries", "geojson/conus.geojson").

constructor(id: String, url: String? = null, metadataUrl: String? = null, minZoom: Float? = null, maxZoom: Float? = null, bounds: LatLonBounds? = null, tileSize: TileSize? = null, attribution: String? = null, authenticator: XweatherAuthenticator? = null, bundledAssetPath: String? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var bounds: LatLonBounds?
Link copied to clipboard

Optional Android asset path packaged under src/main/assets/ (app or MapsGL SDK AAR). When set, com.xweather.mapsgl.map.MapController.addSource loads the GeoJSON into com.xweather.mapsgl.sources.GeoJSONSource.data automatically.

Link copied to clipboard
open override val id: String

Stable id used as the Mapbox style source id and MapsGL registry key.

Link copied to clipboard
open override val kind: DataSourceKind

Discriminator matching com.xweather.mapsgl.sources.DataSource.kind after registration.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var url: String?