Reputation: 11
I am following a tutorial on how to create your own custom map. I sliced my image into tiles, but nothing loads when I go to view the page.
The JavaScript:
L.tileLayer('/Users/ranichd/Desktop/maptest/{z}_{x}_{y}.png', {
minZoom: 1,
maxZoom: 6,
attribution: 'David'
}).addTo(map);
The CSS:
#carpmap2 {
height: 400px;
width: 900px;
margin: auto;
padding: 10px;
border: 1px solid black;
}
A screenshot of the map tiles:
And finally, the result I am getting:
How can I make this work?
Upvotes: 0
Views: 204
Reputation: 10008
Your tiles have to be served by an http server.
L.tileLayer('http://yourhost/maptest/{z}_{x}_{y}.png', {
minZoom: 1,
maxZoom: 6,
attribution: 'David'
}).addTo(map);
Upvotes: 1