You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, we have a symbollayer with geoJsonSource. We want to update position (geometry) of this layer every second. So we add geometry-feature with addGeoJsonSourceFeatures and update with updateGeoJsonSourceFeatures. See code below.
fun initMarker() {
val markerSource = geoJsonSource("currentMarkerSource")
markerSource.addGeoJSONSourceFeatures(
listOf(
Feature.fromGeometry(
Point.fromLngLat(0.0, 0.0),
null,
"geoId"
),
)
)
style.addSource(markerSource)
}
fun updateMarker(point: Point) {
val feature = Feature.fromGeometry(point, null, "geoId")
val locationSource = style.getSource("currentMarkerSource") as? GeoJsonSource
locationSource?.updateGeoJSONSourceFeatures(features)
}
Mapbox returns error:
Error: [maps-core]: {}[Style]: Failed to load source currentMarkerSource: Cannot create new geojson impl for Update/Remove feature operations
What are we missing? Also tried to set dataId on addGeoJsonSourceFeature and updateGeoJsonSourceFeature, but didn't help. Couldn't find an example.
The text was updated successfully, but these errors were encountered:
I also don't understand why your code does not work, but maybe an alternative solution might be helpful. It is very similar to what you have implemented but using the FeatureCollection instead of the feature array directly.
To get the FeatureCollection you just use the method FeatureCollection.fromFeatures(<your_features_array>) and this way it should be fine.
Anyway I am finding some weird bugs on source data update specially using the compose version of mapbox. I always have to use old methods because updates of GeoJSONData in compose source are very buggy if they are frequent. I am unsure how can I improve this and the fact that there are little documentation and examples for compose is really bad for the ones trying to use this library
Environment
Observed behavior and steps to reproduce
Hi, we have a symbollayer with geoJsonSource. We want to update position (geometry) of this layer every second. So we add geometry-feature with addGeoJsonSourceFeatures and update with updateGeoJsonSourceFeatures. See code below.
Mapbox returns error:
Error: [maps-core]: {}[Style]: Failed to load source currentMarkerSource: Cannot create new geojson impl for Update/Remove feature operations
What are we missing? Also tried to set dataId on addGeoJsonSourceFeature and updateGeoJsonSourceFeature, but didn't help. Couldn't find an example.
The text was updated successfully, but these errors were encountered: