I have a map with various vector layers, and I would like to be able to decide which layer goes on top of which. I thought that inserting the layers in the map layer group using:

map.getLayers().insertAt(zIndex, layer);

would force the layers to be drawn in that specific order, but that does not work.

Any suggestions?

closed as off-topic by underdark Jan 25 '18 at 18:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – underdark
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Do you have any other code? – Rui Lima May 21 '14 at 12:55
  • That should work @GabrielePallaver. I'm guessing you've got another problem that we're not able to see without you sharing additional code... – sfletche Nov 1 '14 at 5:27

Browse other questions tagged or ask your own question.