Using Leafletjs to upload coords from a json file as a polygon. The original coordinates are Vicgrid94(3111). I used QGIS to change the projection to LatLng (4326).
When I load the points onto my Leaflet map though, they're slightly off. If I zoom in they get more accurate, but I want to limit the zoom.
My firewall at the office is blocking JSFiddle, sorry.
Here is my relevant code:
var map = L.map('map',{
center: [-38.610980250630381,143.88599774132959],
zoomControl: true,
zoom: 13,
maxZoom: 17,
minZoom: 3
});
L.tileLayer('http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
}).addTo(map)
function loadData(count){
thisShape = L.geoJson(data[count], {
style: function (feature) {
return {
color: '#000',
weight: 1
};
}
}).addTo(map)
}
loadData(0)
This data is an array of geoJSON objects.
I tried placing crs: L.CRS.Simple
and continuousWorld: true
in the map
and tilelayer
objects, but this just changed the location of the map centre and polygon. Similar results for L.CRS.EPSG3857
and L.CRS.EPSG4326
EDIT
I've also tried exporting my data as projection 3857. But this did not seem to show up on my map, including when I set crs: L.CRS.EPSG3857
It seems the L.CRS.Simple projection wouldn't have worked anyway.
EDIT #2
Here is the same map, with a different geoJSON object, at a further level. There's even more of the fire area in the ocean.