【问题标题】:Leaflet js geojson coordinates = Lat/lng from googlemapLeaflet js geojson 坐标 = 来自 googlemap 的 Lat/lng
【发布时间】:2016-09-25 06:42:55
【问题描述】:

我是传单js的新手

阅读leaflet js网站的geojson部分。

一个简单的问题,geojson 格式的坐标,它与我们可以从谷歌地图获得的lay/lng 相同吗?

吉米

【问题讨论】:

    标签: leaflet geojson


    【解决方案1】:

    是的,但你必须反转 lat 和 lng。

    例如,如果您点击巴黎,您将通过 GoogleMap 获得以下坐标:48.857031, 2.346526

    如果你用http://geojson.io/ 生成一些geojson,你会得到:

    {
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "properties": {},
          "geometry": {
            "type": "Point",
            "coordinates": [
              2.349529266357422,
              48.856414043180365
            ]
          }
        }
      ]
    }
    

    另请注意,GoogleMap 仅处理 6 位小数(足够)

    【讨论】:

      猜你喜欢
      • 2018-02-19
      • 1970-01-01
      • 2016-02-01
      • 2017-05-23
      • 1970-01-01
      • 1970-01-01
      • 2010-11-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多