Answer the question
In order to leave comments, you need to log in
How to fix coordinates on Leaflet custom map?
What was done
SasPlanet pulled out the OSM (Open Street Map) map tiles from the cache. Using the Leaflet library, I brought the map to the page:
<body>
<div id='map'></div>
<script src="./script.js"></script>
</body>
var osm = L.tileLayer('./map/OsmCircle/{z}/{dop}/{x}/{dop}/{y}.png',{ maxZoom: 15, dop: '0' });
var map = L.map('map',{center: [76.5, -48.5], zoom:5, layers: osm});
var baseLayers = {"Open Street Map": osm};
L.control.layers(baseLayers).addTo(map);
L.control.mousePosition().addTo(map);
Answer the question
In order to leave comments, you need to log in
So, got it. Thanks for the advice Moskus he gave me the right thoughts.
I looked at my map in developer mode and saw that at scales from 1 to 3, LeafLet was completing the gray tiles. I counted their number and came to the following conclusion:
You just had to map z1 - 0 , z2 -1 , etc. Due to the lack of the necessary tiles, LeafLet began to be tricky with the coordinates, after fixing everything became normal. The "infinity" of the map appeared, i.e. tiles as you scroll left and right are completed again.
Ps I also advise you to display the marker at the point 0; 0 on a large scale, it should stand at the intersection of the equator and the zero meridian, if everything is so, then the reading will be correct.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question