NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum



I was using leaflet to get map from openstreet map and came across this.


could anyone explain it to me? I got the map but not in the right position and the right portion that i wanted

thank you

asked 20 Jun '12, 04:03

frensforall's gravatar image

accept rate: 0%

edited 24 Jun '12, 17:11

stephan75's gravatar image


Leaflet displays a map by displaying a series of tiles across the page. It needs to know where to get these tiles from and how the tiles are stored in a directory structure. The statement you quote shows leaflet how the OSM tiles are structured. If you used tiles from another source the structure would be different.

Leaflet has fairly good documentation, the part describing how the tiles are structured is here:

permanent link

answered 20 Jun '12, 12:10

ChrisH's gravatar image

accept rate: 15%

That line looks like the placeholder string for the url to the tiles that make up the standard layer. Leaflet will replace all the strings in curly braces '{}' to get the url for the tile it wants.

For instance will give you a nice tile covering the south of england.

permanent link

answered 20 Jun '12, 07:11

Gnonthgol's gravatar image

Gnonthgol ♦
accept rate: 16%

The tile layer definition has z, x, and y in it. They're replaced with actual values whenever Leaflet needs to fetch a tile. If you've got a working map, but it's centered on the wrong, you probably just need to tell Leaflet where to centre the map.

If you look at this example, you'll see that it contains:

map.setView(new L.LatLng(51.3, 0.7),9);

It's that function call that tells Leaflet where to centre the map and at what zoom level. If you replace "51.3" with the latitude you want, "0.7" with the longitude, and 9 with the zoom level, you'll get a map centred wherever you want it.

permanent link

answered 20 Jun '12, 09:36

SomeoneElse's gravatar image

SomeoneElse ♦
accept rate: 16%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 20 Jun '12, 04:03

question was seen: 54,730 times

last updated: 24 Jun '12, 17:11

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum