开发者

Google Maps v3 Polygon, Polyline intersection

I have a polygon and polyline created dynamically. Now I need to check whether they both intersect each other or not.

When a user comes and places a marker i'm creating a polygon with some radius as th开发者_如何学JAVAe buffer distance. I have the polylines(routes) pre defined in my database. I need to get that polylines and check whether they are intersecting or not.

I didn't find any kind of methods in the google maps v3 API. someone please help me for the same.

Thanks, Karthik Reddy


Good starting point is checking if a point is in a polygon. Below is a link which shows it done for a point. Since a line is a collection of points you have to check an array of points would have to modify the code below to check an array of points (your polyline)

https://web.archive.org/web/20160414021100/http://blog.appdelegateinc.com/point-in-polygon-checking-with-google-maps.html

(note this works with api v2) but it could be easily converted to v3

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜