Leaflet will become even better if you add …

Layer order control

Ability to easily control the z-index order of tile and vector layers.

102 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Vladimir AgafonkinAdminVladimir Agafonkin (maintainer, Leaflet) shared this idea  ·   ·  Admin →
    started  ·  Vladimir AgafonkinAdminVladimir Agafonkin (maintainer, Leaflet) responded  · 

    The problem with this feature is that SVG doesn’t support z-index ordering by design. The only way to do this is to reorder DOM objects, which is quite inefficient if you want precise control. It’s even worse in Canvas where you have to rerender all layers in the correct order.

    In the current master version, I’ve implemented bringToBack and bringToFront methods for both vector and tile layers which should satisfy most of the use cases here, but will continue designing a more sophisticated solution.

    4 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • AstoniAstoni commented  · 

        I have found that the order of the DOM objects does control the order of the tile layers (first statement is first) in Firefox Funnelcake and Chrome Version 32.0.1700.102 m, but NOT in Internet Explorer 11.

      • Thomas SchmidtThomas Schmidt commented  · 

        Would this change allow to lay transparent tile layers on top of the tjson map? Those decorating tile layer don't need to be clickable, just click-through to the vector map. Is that possible?

        Do you have a roadmap/timeframe when layer order control might be implemented completely?

        Thanks,
        Thomas

      • TWTW commented  · 

        Ok, I an imagine that this feature probably is not solvable so easily...
        Currently we use Openlayers but I would really like to use Leaflet in the feature because of its general performance . Just our scientific background requires that we show more than some baselayers in the map...Thanks for the fast response and for having this on the planned feature list!

      • TWTW commented  · 

        Any updates on this? I plan to use Leaflet once it has a proper layer management where I can order layers in a stack and change the position. Also openlayers is going this direction...The artificial limitation in current APIs is somehow a relict of the past :-)

      Feedback and Knowledge Base