Václav Mikeska
Václav Mikeska

Reputation: 507

Bring tileLayer to front in Leaflet

Is it possible to display tileLayer on top of all other layers? This means that all other layers are displayed below the tileLayer.

Googled all day, but couldn't find definite yes or no.

Upvotes: 2

Views: 1772

Answers (2)

IvanSanchez
IvanSanchez

Reputation: 19079

Create a map pane on top of (with a higher z-index than) the standard tile pane, and position your tile layer in it.

There is an entire Lealfet tutorial on the issue.

Upvotes: 2

nrhode
nrhode

Reputation: 942

Yes you can manipulate the order by simply adding this code:

var topPane = map._createPane('leaflet-top-pane', map.getPanes().mapPane);
topPane.appendChild(yourtileLayer.getContainer());
yourtileLayer.setZIndex(5);

Upvotes: 3

Related Questions