GeoJson features coordinates are in meters not in [lng, lat]. How to display in google map?

冷暖自知 提交于 2020-01-29 05:23:27

问题


Eg: [360590, 555610] - [lng, lat] in meters from google map api - GeoJson data

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "MultiPolygon",
        "coordinates": [
          [
            [
              [
                360590,
                555610
              ],
              [
                360590,
                555555.0128
              ],
              [
                360590,
                555540
              ],
              [
                360592.4439,
                555540
              ],
              [
                360600,
                555540
              ],
              [
                360600,
                555518.8277
              ]
            ]
          ]
        ]
      }
    }
  ]
}

here, [360590, 555610] - [X, Y] coordinates is in meters, Now we need to display this coordinates on google map, Is there any solution for this?

also we must have to use addGeoJson or loadGeoJson method because we have 200MB data in GeoJson file. Now we need to display this coordinates on google map, Is there have any solution for this?


回答1:


Are you sure that these coordinates are in a meter?

It may be EPSG: 27700 or EPSG:4326 so you can try with it.

and you this link QGIS for convert coordinates and It might be useful for you.




回答2:


Mapbox has a Utility class that can perform the conversion of meters to latitude/longitude for you:

public static Vector2d MetersToLatLon(Vector2d m)

Converts Spherical Mercator EPSG:900913 in xy meters to WGS84 lat/lon.

public static Vector2d LatLonToMeters(Vector2d v)

Converts Vector2d struct, WGS84 lat/lon to Spherical Mercator EPSG:900913 xy meters.

If you're looking to do the conversion yourself, then a simple approach is the following:

  • Assume the earth is a sphere with a circumference of 40,075km.
  • Length in meters of 1° of latitude is always 111.32km
  • Length in meters of 1° of longitude = 40,075 km * cos(latitude) / 360


来源:https://stackoverflow.com/questions/59508865/geojson-features-coordinates-are-in-meters-not-in-lng-lat-how-to-display-in

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