获取谷歌地图中某个位置的边界多边形坐标

时间:2015-07-09 07:52:23

标签: google-maps kml

我希望能够在Google地图中获取绑定特定区域(地点)的多边形顶点的坐标。

例如。如果我输入:

高尔夫布局(印度班加罗尔的一个地方)在Google地图中显示了一个边界区域。

我发现Google Maps Api v3无法实现,但使用KML图层可能有所帮助。有人可以解释一下。

1 个答案:

答案 0 :(得分:1)

如果KML数据在线可用,则可以使用google.maps.KmlLayer访问它。请在此处查看示例(您可能会理解它;这是一个非常简单的示例):https://developers.google.com/maps/documentation/javascript/examples/layer-kml

//make an instance of google.maps.KmlLayer, using the URL with the desired KML data.
var ctaLayer = new google.maps.KmlLayer({
    url: 'http://gmaps-samples.googlecode.com/svn/trunk/ggeoxml/cta.kml'
});

//set the KmlLayer to a map
ctaLayer.setMap(map);

同样,这个功能的使用非常简单。

相关问题