简体   繁体   English

使用GeoJson将标记添加到Google地图

[英]Add marker to google maps by using GeoJson

I have no idea how to add a marker from a GeoJson . 我不知道如何从GeoJson添加标记。

The data I have to use is something like: 我必须使用的数据是这样的:

"geometry": {  
        "type":"Point",
        "coordinates":[  
           727053.159,
           4374119.505
        ]
     }

I supposed the coordinates would be Latitude and Longitude but what I have tried doesn't work: 我以为坐标经度纬度 ,但是我尝试的方法不起作用:

private fun createMarker(
    latitude: Double,
    longitude: Double,
    title: String,
    snippet: String
): Marker {
    return mMap.addMarker(
        MarkerOptions()
            .position(LatLng(latitude, longitude))
            .title(title)
            .snippet(snippet)
    )
}

Any idea how to add the marker from geojson data? 任何想法如何从geojson数据添加标记?

Andrew Reid is absolutely right: your GeoJSON data is not in WGS84 Latitude/Longitude degrees. Andrew Reid绝对正确:您的GeoJSON数据不在WGS84纬度/经度中。 You should determine coordinate reference system (CRS) of your GeoJSON eg by checking its "crs" tag. 您应确定GeoJSON坐标参考系统(CRS),例如,通过检查其"crs"标签。 If there is "crs" here is some tips how to determine unknown coordinate system. 如果有"crs" 这里有一些提示,用于确定未知坐标系。 I would start trying from UTM . 我将从UTM开始尝试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM