3857坐标的传单中

3857坐标的传单中

本文介绍了将GeoJSON导入具有n CRS epsg:3857坐标的传单中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请耐心等待,因为我对整个地图领域还是相当陌生

我有一个geoeps文件,其坐标以epsg:3857格式给出

{"name":"2011","type":"FeatureCollection"
,"crs":{"type":"name","properties":{"name":"EPSG:3857"}}
,"features":[{  "type":"Feature",
        "geometry": {"type":"Polygon", "coordinates":[[[16455748.301877,-4074559.33797376],[16455757.520912,-4074683.80559603],[16455834.5041285,-4074749.65646613]]]},
        "properties":{"CODE":"LGA12200","LGA_NAME":"Cootamundra (A)","STATE_CODE":"1","STATE_NAME":"New South Wales","AREA_SQKM":1523.75245790713}
    }
    ]
}

当我使用L.geojson(...)将其导入到传单中时,多边形是在地图上形成的...我知道这是因为坐标在EPSG:3857中.

导入时如何将它们转换为经纬度长的坐标?

geojson文件中大约有100个功能

我导入json文件的代码是:

$.getJSON("js/output1.json", function (data) {

    // create geojson object
    L.geoJson(data).addTo(map);
}
解决方案

在使用L.geojson导入坐标之前,应先对其进行转换.找到执行此转换的算法,为您的geoJSON创建一个解析器,并使用转换后的坐标生成一个新的解析器.然后用L.geoJson加载它们.

您当然应该在服务器端执行此操作,但是如果您只有geoJSON文件,则可以这样做.

Please bear with me as I am fairly new to this whole maps things

I have a geojson file with the coordinates given in the epsg:3857 format

{"name":"2011","type":"FeatureCollection"
,"crs":{"type":"name","properties":{"name":"EPSG:3857"}}
,"features":[{  "type":"Feature",
        "geometry": {"type":"Polygon", "coordinates":[[[16455748.301877,-4074559.33797376],[16455757.520912,-4074683.80559603],[16455834.5041285,-4074749.65646613]]]},
        "properties":{"CODE":"LGA12200","LGA_NAME":"Cootamundra (A)","STATE_CODE":"1","STATE_NAME":"New South Wales","AREA_SQKM":1523.75245790713}
    }
    ]
}

When I import this into leaflet using L.geojson(....), the polygon is formed off the map...I know that this is because the coordinates are in the EPSG:3857..

How do I convert these to lat long coords when I import them?

There are around 100 features in the geojson file

my code to import the json file is:

$.getJSON("js/output1.json", function (data) {

    // create geojson object
    L.geoJson(data).addTo(map);
}
解决方案

You should convert the coordinates before you import them with L.geojson. Find an algorithm that does this conversion, create a parser for your geoJSON and generate a new one with the converted coordinates. Then load them with L.geoJson.

Of course you should do this on the server side, but if you only have the geoJSON file than this is the way.

这篇关于将GeoJSON导入具有n CRS epsg:3857坐标的传单中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 07:39