How to plot city in map via boundary line? [closed]

自闭症网瘾萝莉.ら 提交于 2019-11-27 09:08:06

问题


How can I plot boundary line on G-Map on the basis of city searched like in this image red line showing searched city map?

I have see various links but unable to find a solution.

Thanks


回答1:


Currently Google Maps JavaScript API doesn't expose any boundaries of geographic features. There is very old feature request in the public issue tracker to add this functionality, however it looks like Google didn't set high priority on this task:

https://issuetracker.google.com/issues/35816953

Feel free to star the public feature request to express your interest and subscribe to notifications.

Also, you can find a workaround to get polygons from other sources and add them to Google maps as additional layers.

The nice workaround to get polygons in GeoJSON format from OSM is described in the following answer:

https://stackoverflow.com/a/40172098/5140781

So, if you download the GeoJSON you will be able to add it to map using the data layer and its loadGeoJson() method:

https://developers.google.com/maps/documentation/javascript/datalayer#load_geojson

I hope this helps!



来源:https://stackoverflow.com/questions/45589559/how-to-plot-city-in-map-via-boundary-line

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