Geo JSONSource
Runtime GeoJSON data source for map layers that consume geographic features (points, lines, polygons).
Instances are created when you call com.xweather.mapsgl.map.MapController.addSource with a com.xweather.mapsgl.sources.source.spec.GeoJSONSourceDescriptor. Retrieve the same instance with com.xweather.mapsgl.map.MapController.getSource and cast to GeoJSONSource to update a remote url, assign in-memory data, or refresh after changes.
Remote URL: set url to a template string. makeDataURL expands {startDate} and {endDate} from timeRange (ISO-style via com.xweather.mapsgl.utils.replaceVars), URL-encodes values, and—when authenticator is an XweatherAuthenticator—merges {accessKey}, {clientId}, {clientSecret} and the documentation segment [CLIENT_ID]_[CLIENT_SECRET] like tile sources. If the descriptor omitted com.xweather.mapsgl.sources.source.spec.GeoJSONSourceDescriptor.authenticator, com.xweather.mapsgl.map.MapController.addSource attaches com.xweather.mapsgl.weather.WeatherService.authenticator automatically.
Inline data: set data to a Mapbox FeatureCollection (for example from FeatureCollection.fromJson(...)). You can use this together with or instead of a remote url, depending on your pipeline.
Events: onLoadStart, onLoadComplete, and related signals fire around load lifecycle (see each property).
See also
Properties
Optional attribution string for map credits.
Optional authenticator for remote requests. When this is an XweatherAuthenticator, credential placeholders in url are expanded in makeDataURL.
Parsed GeoJSON features served directly by the app, or null when using only url. Assigning a new value notifies onDataChange and pushes geometry to the map style when this source is bound (see pushGeoJsonToMapStyle).
Increments on every data assignment. com.xweather.mapsgl.renderers.TileLayerRenderer uses this to avoid rebuilding GLES stencil meshes from GeoJSON on every frame for the same tile + data.
High-level source family (raster, encoded, vector, …).
Dispatched when data or derived features change.
Dispatched when a load operation finishes successfully.
Dispatched when a load operation begins.
Dispatched when metadata loading fails (reserved for future metadata support).
Dispatched when metadata has been parsed (reserved for future metadata support).
Dispatched when metadata fetch starts (reserved for future metadata support).
com.xweather.mapsgl.map.MapController.mapSessionId that owns in-flight / ready tile bookkeeping.
Active time window merged into URL variables as startDate and endDate when building a request URL.
Alias for DataSource.kind (matches JS naming type).
Remote GeoJSON endpoint template, or null if the source is driven only by data. Placeholders follow com.xweather.mapsgl.utils.replaceVars (e.g. {startDate}, {endDate}).
Optional list of valid observation times for time-enabled GeoJSON products (product-specific).
Functions
Register a layer that should receive updates when this source loads or changes.
Used by prepareTileRequest() to increment or decremnet the time and reformate it for sources with time offets
Returns the metadata for the source, which can be loaded from a remote source.
Metadata is not implemented for this source type; calling this method throws kotlin.NotImplementedError.
Plain ISO-8601 for URL path {time} segments (encoded tile GET). Cache keys and POST validTimes still use bracketed ["…"] strings.
convert from \"2025-04-22T03:49:31Z\" to 20250422030000
Builds a resolved HTTP(S) URL from url and the given variables, merged with timeRange bounds and XweatherAuthenticator.appendTileCredentialVariables when applicable. Values are URL-encoded.
Unregister a layer previously added with addConsumer.