Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
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

Closed

Description

@guruduttstay

Platform: Android
Mapbox SDK version:4.1.0-beta

Steps to trigger behavior

  1. Allow setting/adding multiple Icons to Marker and allow setting to display it at certain zoom level.
  2. 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
  3. 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

Activity

  1. added
    Android
    annotations
    on Jun 23, 2016
  2. tobrun commented on Jun 23, 2016

    @tobrun
    Member

    @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.

  3. 1ec5 commented on Jun 23, 2016

    @1ec5
    Contributor

    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.

  4. reopened this on Jun 23, 2016
  5. tobrun commented on Jun 24, 2016

    @tobrun
    Member

    @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.

  6. changed the title [-]Multiple icon for same Marker[/-] [+]Change icon of a Marker when zoomlevel changes[/+] on Jun 24, 2016
  7. tobrun commented on Jun 24, 2016

    @tobrun
    Member

    @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.

  8. guruduttstay commented on Jun 24, 2016

    @guruduttstay
    Author

    @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 :)

  9. 1ec5 commented on Jun 24, 2016

    @1ec5
    Contributor

    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.

  10. guruduttstay commented on Jun 27, 2016

    @guruduttstay
    Author

    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 :)

  11. SylvainHocq commented on Aug 17, 2016

    @SylvainHocq
    Contributor

    I'm also interested by this feature.

  12. 1ec5 commented on Aug 17, 2016

    @1ec5
    Contributor

    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).

  13. cammace commented on Nov 9, 2016

    @cammace
    Contributor

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Androidannotations

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions