Highlighting whole street with some maps API

自闭症网瘾萝莉.ら 提交于 2019-11-26 19:41:42

问题


Is there any way to highlight/display on Google/Bing/(any other map provider) Maps whole street (from the beginning of the street to the end of)?

I know the existence of Polyline in Google Maps API, but it's just connecting two latitude points, and there is no way of making it automatic so I could display any street in some city.

Also I was thinking about Directions, but many street are 2 way, there is no guarante that you will mark whole street and it's just now user friendly. Example


回答1:


You may want to check Mike Williams' article on how to snap points and polylines to streets with the Google Maps API:

  • Snap points (and polylines) to street

Especially this example:

  • Click on the map and a path will be drawn that follows the streets.



回答2:


Take a look at OpenStreetMap. (Google and Bing won't let you access their underlying street data.)

You can show a map with OSM tiles, and use the API to query for the features you're interested in displaying on the map. OpenLayers is a javascript mapping library that could support this.

Here's a view of Chicago showing street vectors and other features overlaid on top of the map tiles:

http://www.openstreetmap.org/?lat=41.902104&lon=-87.626441&zoom=18&layers=B000FTTT



来源:https://stackoverflow.com/questions/2155032/highlighting-whole-street-with-some-maps-api

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