Skip to main content
spelling
Source Link
Ian Turton
  • 83.2k
  • 6
  • 89
  • 189

leaflet map crs is 3857 but coorditaescoordinates 4326

I am developing my first leaflet applicaitonsapplications. So this is my trial applicaitonapplication demo.

       var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
            osm = L.tileLayer(osmUrl, {
                maxZoom: 18,
               
            });

        var map = L.map('map').setView([51.505, -0.09], 12).addLayer(osm);

I am getting the CRS of the map, and CRS is EPSG:3857.

 console.log("map crs: " + map.options.crs.code)

I can add a point data with EPSG:4326 coordinates.

L.marker([51.5, -0.09]).addTo(map)
.bindPopup('A popup.')
.openPopup();

But I can not add EPSG:3857 coordinates.

    L.marker([5732953.77585,-10018.7582914]).addTo(map)
    .bindPopup('A popup.')
    .openPopup();

This goes wrong place.

leaflet map crs is 3857 but coorditaes 4326

I am developing my first leaflet applicaitons. So this is my trial applicaiton demo.

       var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
            osm = L.tileLayer(osmUrl, {
                maxZoom: 18,
               
            });

        var map = L.map('map').setView([51.505, -0.09], 12).addLayer(osm);

I am getting the CRS of the map, and CRS is EPSG:3857.

 console.log("map crs: " + map.options.crs.code)

I can add a point data with EPSG:4326 coordinates.

L.marker([51.5, -0.09]).addTo(map)
.bindPopup('A popup.')
.openPopup();

But I can not add EPSG:3857 coordinates.

    L.marker([5732953.77585,-10018.7582914]).addTo(map)
    .bindPopup('A popup.')
    .openPopup();

This goes wrong place.

leaflet map crs is 3857 but coordinates 4326

I am developing my first leaflet applications. So this is my trial application demo.

       var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
            osm = L.tileLayer(osmUrl, {
                maxZoom: 18,
               
            });

        var map = L.map('map').setView([51.505, -0.09], 12).addLayer(osm);

I am getting the CRS of the map, and CRS is EPSG:3857.

 console.log("map crs: " + map.options.crs.code)

I can add a point data with EPSG:4326 coordinates.

L.marker([51.5, -0.09]).addTo(map)
.bindPopup('A popup.')
.openPopup();

But I can not add EPSG:3857 coordinates.

    L.marker([5732953.77585,-10018.7582914]).addTo(map)
    .bindPopup('A popup.')
    .openPopup();

This goes wrong place.

Source Link
barteloma
  • 1.7k
  • 5
  • 24
  • 47

leaflet map crs is 3857 but coorditaes 4326

I am developing my first leaflet applicaitons. So this is my trial applicaiton demo.

       var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
            osm = L.tileLayer(osmUrl, {
                maxZoom: 18,
               
            });

        var map = L.map('map').setView([51.505, -0.09], 12).addLayer(osm);

I am getting the CRS of the map, and CRS is EPSG:3857.

 console.log("map crs: " + map.options.crs.code)

I can add a point data with EPSG:4326 coordinates.

L.marker([51.5, -0.09]).addTo(map)
.bindPopup('A popup.')
.openPopup();

But I can not add EPSG:3857 coordinates.

    L.marker([5732953.77585,-10018.7582914]).addTo(map)
    .bindPopup('A popup.')
    .openPopup();

This goes wrong place.