v-leaflet layers ordering

Hello,

I put 10 layers on the map and have to enable user to change their ordering. Can I do this without removing all layers?

Thanks a lot.

Hi,

At least TileLayer has zIndex property that you can adjust. But if you want to expose some methods to adjust the layer order in the underlaying List in LMap/LLayerGroup is fine for me.

cheers,
matti

Hi Matti,

I don’t succeed to reorder layers. What i did so far: I removed all my layers (not base) and added them in a different order.
Nothing changes on the map. If I add only one layer map repainted as expected.

Thank you,
alla

Hi,

Don’t know whats wrong, but I wouldn’t be suprised if there was an issue. The ordering is bit tricky with Vaadin 7 (unless components are GWT widgets) as updates are received in undeterministic order.

Do you have a checkout of the project or could you take one (also grab g-leaflet & g-leaflet-draw)? If you could add a small reduced test case about the issue, it would help me a lot to look at the issue. The test environment is started by executing TServer class in the project.

BTW. What is the use case for you usually? Do you just need to lift some layer on top of others or does the exact order of all layers matter? Easy workaround might be to implement bringToFrom/Back (existing Leaflet API) for each layers as client RPC. RPC calls should be executed in correct order, so the implementation should be very easy and stable.

cheers,
matti

Hi,

There is now bringToFront/Back methods available in the
github version
.

cheers,
matti

Thank you very much, Matti, for adding this functionality.
Our case requires strict ordering of all layers. If you can expand functionality, it will be really helpful.
When do you plan to release current functionality?

Hi,

There are some other small fixes and enhancements in github as well, so I guess I could make a maintenance release today or tomorrow. Before that I think I should improve the solution so that the internal ordering is updated as well. Now reload (on UIs with @PreserveOnRefresh) will mess the order again.

For the strict ordering, I’d really appreciate if you could provide that test case. I thought it works, but I’m not suprised if there are issues. Fixing them might need some larger refactoring.

cheers,
matti

Hi Matti,

I’ve sent you example by mail. There are 2 layers (red and blue) and I try to reorder them.