Javascript 获取道路的几何图形(线/图形)

Javascript 获取道路的几何图形(线/图形),javascript,google-maps,google-maps-api-3,Javascript,Google Maps,Google Maps Api 3,如何获取阵列中道路的几何图形(直线/图形) 有可能吗 谢谢 [对不起,我的英语不好]这在谷歌地图上是不可能的。像这样的开源web服务能够在给定范围内返回数据库中所有道路(几乎都是道路)的几何图形。可以使用名为的API在HTTP中检索此数据 查找属于特定道路的所有节点的查询可以是: way(s,w,n,e)["name"="Your Road Name"];out; s、 w、n、e是数据来源的南、西、北和东边界 你需要知道大概的界限。这可以通过在谷歌中对道路进行地理编码,然后将返回的坐标扩展0

如何获取阵列中道路的几何图形(直线/图形)

有可能吗

谢谢


[对不起,我的英语不好]

这在谷歌地图上是不可能的。像这样的开源web服务能够在给定范围内返回数据库中所有道路(几乎都是道路)的几何图形。可以使用名为的API在HTTP中检索此数据

查找属于特定道路的所有节点的查询可以是:

way(s,w,n,e)["name"="Your Road Name"];out;
s、 w、n、e是数据来源的南、西、北和东边界

你需要知道大概的界限。这可以通过在谷歌中对道路进行地理编码,然后将返回的坐标扩展0.1度来实现

这将返回一个XML文档:

<osm version="0.6" generator="Overpass API">
<note>
The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.
</note>
<meta osm_base="2015-08-17T12:36:02Z"/>
<way id="16578496">
<nd ref="2399812387"/>
<nd ref="2399812388"/>
<nd ref="2399812389"/>
<nd ref="2399812390"/>
<nd ref="171131426"/>
<tag k="highway" v="residential"/>
<tag k="name" v="Halifax Court"/>
<tag k="tiger:cfcc" v="A41"/>
<tag k="tiger:county" v="Guilford, NC"/>
<tag k="tiger:name_base" v="Halifax"/>
<tag k="tiger:name_type" v="Ct"/>
<tag k="tiger:reviewed" v="no"/>
<tag k="tiger:zip_left" v="27265"/>
<tag k="tiger:zip_right" v="27265"/>
</way>
</osm>
一次只能查询一个节点。这将返回如下结果:

<osm version="0.6" generator="Overpass API">
<note>
The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.
</note>
<meta osm_base="2015-08-17T12:58:02Z"/>
<node id="2399812389" lat="36.0107609" lon="-79.9805742"/>
</osm>

本文件中包含的数据来自www.openstreetmap.org。数据在ODbL下提供。
将所有点的纬度/经度数据组合成多段线后,就有了道路几何图形

<osm version="0.6" generator="Overpass API">
<note>
The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.
</note>
<meta osm_base="2015-08-17T12:58:02Z"/>
<node id="2399812389" lat="36.0107609" lon="-79.9805742"/>
</osm>