Is it possible to move SymbolLayer icon as per the updated location points?

659 views Asked by At

I wants to move SymbolLayer icon on the map layer as per the position change, move like as a marker. In the latest Mapbox update, MarkerView and MarkerViewOptions is deprecated. So I want to move the SymbolLayer icon.

Please help me to make it work.

Thanks

1

There are 1 answers

0
langsmith On

There are several ways you can do this and it's kinda' dependent on what type of source + layer you're going to use. First read https://docs.mapbox.com/android/java/overview/geojson/#geojson-updates

  1. https://docs.mapbox.com/android/maps/examples/animate-marker-position/
  2. If you're using a GeoJsonSource, you'll set new geojson on the source when you know the new coordinate(s) that you want the SymbolLayer icon to move to https://github.com/mapbox/mapbox-android-demo/search?q=setGeoJson. Make sure you're updating the GeoJsonSource that the SymbolLayer is using.
  3. There's the annotation plugin, which handles lots of the layer/source boilerplate code you'd have to ordinarily write: https://docs.mapbox.com/android/plugins/overview/annotation/. symbol.setLatLng(); and symbolManager.update(); will be helpful. See https://github.com/mapbox/mapbox-plugins-android/blob/master/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/SymbolActivity.java and https://docs.mapbox.com/android/plugins/examples/symbol-listener/