Google Maps - Create a polygon around existing markers

心不动则不痛 提交于 2019-12-02 06:09:37

问题


I dont know if this is possible but I use a google map to plot out positions of entities via markers on an overlay. I would like to be able to create a polygon or some other sort of overlay object around all the created markers, highlighting the extent of the markers, sort of a catchment area diagram. I wont know before all the markers are retrieved from the database and mapped what the extent is.

Anyone have any ideas how to approach this..?

Thanks


回答1:


I think you are looking for the Convex Hull of the points

In mathematics, the convex hull or convex envelope of a set X of points in the Euclidean plane or Euclidean space is the smallest convex set that contains X. For instance, when X is a bounded subset of the plane, the convex hull may be visualized as the shape enclosed by a rubber band stretched around X.

Example using the Google Maps API v3 on a random set of points



来源:https://stackoverflow.com/questions/14383807/google-maps-create-a-polygon-around-existing-markers

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