Polyline intersection

479 views
Skip to first unread message

Marino Gastelurrutia

unread,
Jan 28, 2012, 7:25:56 AM1/28/12
to google-map...@googlegroups.com
Is there any nice way to find the intersection of two segments in the map?

I've got each segments as a Polyline with one path. I've searched for days, but found nothing.

Thanks.

Joseph Elfelt

unread,
Jan 29, 2012, 2:11:09 PM1/29/12
to Google Maps JavaScript API v3
I'm curious about this also.

Perhaps it would work for your purpose to use the coords (world
coords?) to calculate the intersection of 2 lines.

Is there a better way?

Marcelo

unread,
Jan 29, 2012, 11:43:36 PM1/29/12
to Google Maps JavaScript API v3
How big are the lines?

If they are small then they can be treated as 2D lines on a plane and
the problem is solved in a cartesian coordinate system, which is high
school math:
http://paulbourke.net/geometry/lineline2d/

If they are big then you might want to treat them as 3D, or great
circles on a sphere:
http://geospatialmethods.org/spheres/GCAIntersect.html

Either way, a search in Google yields plenty of relevant results.

--
Marcelo - http://maps.forum.nu
--
Reply all
Reply to author
Forward
0 new messages