Google Maps and GeoJSon: latitude and longitude conversion

自古美人都是妖i 提交于 2019-12-24 07:14:35

问题


I'm using Google Maps API to visualize some label on the map using google.maps.Polygon. I used this converter http://converter.mygeodata.eu/ to convert them in a GeoJSon format, but latitude and longitude coordinates where mistaken.

They should be centered in Florence, Italy, but actually i get this:

 1680508.8375
 4847672.484

I tried tho divide them by 10000 and i got:

 16.805088375
 48.47672484

wich alow me to show some results, but that was not the results I was looking for (I get them displayed in Austria instead of Florence)

Surfing the net I found this https://groups.google.com/forum/?fromgroups#!topic/d3-js/H0zE7slqV0g that describe my problem and find a solution using d3.

Is there any way to do that just with google maps API and/or using some conversion?

Thanks


回答1:


Ok seems that I found what the problem is. There are many different way to locate a point in a map. Google Maps uses a WGS84 encoding, but i got the data in EPSG:3003 encoding. So they didn't match.

I was able to find a js library that makes all the conversion you need.

http://trac.osgeo.org/proj4js/



来源:https://stackoverflow.com/questions/11205333/google-maps-and-geojson-latitude-and-longitude-conversion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!