How to show the transport layer using leaflet

2,277 views
Skip to first unread message

Gareth Newman

unread,
Sep 17, 2014, 8:38:34 AM9/17/14
to leafl...@googlegroups.com
Hey All,

I want my map to be shown like this:-

http://www.openstreetmap.org/#map=15/53.5986/-2.1746&layers=T

Using the transport layer so the roads and rail links really stand out, can this be achieved using leaflet as I can't find the option to display this type of map?

Thanks,

Rowan Winsemius

unread,
Sep 17, 2014, 8:50:08 AM9/17/14
to leafl...@googlegroups.com
Hi Gareth,

Open Street Map provide a range of tile servers of differently styled maps, any of which leaflet can consume, its just a matter of working out the right url.
http://wiki.openstreetmap.org/wiki/Tile_servers

I believe that example is the transport map so you'd use it something like
L.tileLayer('http://a.tile2.opencyclemap.org/transport/$%7Bz%7D/$%7Bx%7D/$%7By%7D.png').addTo(map);

Hope that helps.

Cheers


This message is intended for the addressee named and may contain confidential information. If you are not the intended recipient, please delete it and notify the sender. Views expressed in this message are those of the individual sender, and are not necessarily the views of their organisation.

Gareth Newman

unread,
Sep 17, 2014, 9:05:18 AM9/17/14
to leafl...@googlegroups.com
Thanks rowan, this open map stuff is amazing. It looks like some cnversion took place when you copied the url but it worked perfectly after tweaking it:-

L.tileLayer('http://{s}.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png').addTo(map);
Reply all
Reply to author
Forward
0 new messages