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
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Change icon of a Marker when zoomlevel changes #5451
Allow setting/adding multiple Icons to Marker and allow setting to display it at certain zoom level.
For e.g. if added two Icons iconA, iconB then Display iconA from zoom level 1 to 9 and display iconB from Zoom level 9 to 21
Best would be allow adding different layers to map, all markers added to those layers and it should be possible to control those layers dynamically (e.g. show, hide layers based on Zoom level and other callbacks )
Expected behavior
Actual behavior
I found clustering but that's not what we want :(
Let me know if this is already possible. ... I didn't found it in code or doc yet
@guruduttstay thank you for reaching out, what you are requesting is indeed support for z-layers. We are tracking this feature in #5238. With the 4.1.0-beta we are exposing some support for z-ordering but not in a way that would solve your request in this issue. Closing as a duplicate with #5238.
This request is about varying a marker icon based on the zoom level, not about arranging multiple markers in z-space.
Once #837 is fully implemented in the SDK, it’ll be possible to do this with GeoJSON point features and potentially GL-rendered markers, but those changes alone won’t make it possible with marker views.
@1ec5 thank you for the info on #837. I initially thought this part of the feature request was not something that the SDK would expose and that end developers would implement theirselves using OnCameraChangeListener. I'm going to change the title to make the request itself a bit more clear.
@guruduttstay if urgent, you could try using the OnCameraChangeListener to determine changes in zoom level and update your markers accordingly. We currently don't expose an API to do this on large scale (using the concept of a layer) but the feature itself should be possible.
@1ec5 thank you for reopening issue :) @tobrun it is kind of urgent ... this is one of the strongest feature in our App we want to implement with MapBox :(
I will try OnCameraChangeListener and get back here if that solves our issue, I am concern about performance :)
Can you give us more details about the effect you're trying to achieve with zoom-dependent icons in marker views? For example, are you trying to have the icon's size vary? That information could help us decide on a better API, if any.
Android SDK v4.2.0-beta.1 and iOS SDK v3.2.0-alpha.1 both have support for runtime styling. As long as the icons in question are baked into the style at design time (for example in Mapbox Studio), you can have symbol features transition between the icons based on zoom levels using a zoom function on the iconImage property.
Note that the runtime styling API only supports symbol features, not marker views (Android) or annotation views (iOS). At runtime, you can put point data inside a GeoJSON source and style it using a symbol layer. If you need this functionality for marker views or annotation views, please try the approach described in #5451 (comment).
@guruduttstay and @SylvainHocq, like @1ec5 mentioned, runtime styling has been implemented in the Android SDK now which supports symbol layers. You might find this example particularly useful, along with the other many examples you can find here. Feel free to reach out through our contact page if you guys have any additional questions on how to achieve this. Happy to help.
Activity
tobrun commentedon Jun 23, 2016
@guruduttstay thank you for reaching out, what you are requesting is indeed support for z-layers. We are tracking this feature in #5238. With the
4.1.0-betawe are exposing some support for z-ordering but not in a way that would solve your request in this issue. Closing as a duplicate with #5238.1ec5 commentedon Jun 23, 2016
This request is about varying a marker icon based on the zoom level, not about arranging multiple markers in z-space.
Once #837 is fully implemented in the SDK, it’ll be possible to do this with GeoJSON point features and potentially GL-rendered markers, but those changes alone won’t make it possible with marker views.
tobrun commentedon Jun 24, 2016
@1ec5 thank you for the info on #837. I initially thought this part of the feature request was not something that the SDK would expose and that end developers would implement theirselves using OnCameraChangeListener. I'm going to change the title to make the request itself a bit more clear.
[-]Multiple icon for same Marker[/-][+]Change icon of a Marker when zoomlevel changes[/+]tobrun commentedon Jun 24, 2016
@guruduttstay if urgent, you could try using the
OnCameraChangeListenerto determine changes in zoom level and update your markers accordingly. We currently don't expose an API to do this on large scale (using the concept of a layer) but the feature itself should be possible.guruduttstay commentedon Jun 24, 2016
@1ec5 thank you for reopening issue :)
@tobrun it is kind of urgent ... this is one of the strongest feature in our App we want to implement with MapBox :(
I will try OnCameraChangeListener and get back here if that solves our issue, I am concern about performance :)
1ec5 commentedon Jun 24, 2016
Can you give us more details about the effect you're trying to achieve with zoom-dependent icons in marker views? For example, are you trying to have the icon's size vary? That information could help us decide on a better API, if any.
guruduttstay commentedon Jun 27, 2016
Hi @1ec5
Just recorded screen for current implementation :)
http://bit.ly/28XZPyi
For more info may be you can try Stay.com App from playstore or app store :)
SylvainHocq commentedon Aug 17, 2016
I'm also interested by this feature.
1ec5 commentedon Aug 17, 2016
Android SDK v4.2.0-beta.1 and iOS SDK v3.2.0-alpha.1 both have support for runtime styling. As long as the icons in question are baked into the style at design time (for example in Mapbox Studio), you can have symbol features transition between the icons based on zoom levels using a zoom function on the
iconImageproperty.Note that the runtime styling API only supports symbol features, not marker views (Android) or annotation views (iOS). At runtime, you can put point data inside a GeoJSON source and style it using a symbol layer. If you need this functionality for marker views or annotation views, please try the approach described in #5451 (comment).
cammace commentedon Nov 9, 2016
@guruduttstay and @SylvainHocq, like @1ec5 mentioned, runtime styling has been implemented in the Android SDK now which supports symbol layers. You might find this example particularly useful, along with the other many examples you can find here. Feel free to reach out through our contact page if you guys have any additional questions on how to achieve this. Happy to help.