How to determine whether a route overlaps another route in Google Map?

  • Thread starter vivek91m
  • Start date
  • #1
8
0

Main Question or Discussion Point

I've two routes in google map:

i) A ---> B
ii) C ---> D

How can I determine if these routes overlap or not?
 

Answers and Replies

  • #2
1,254
106
I dont know any computer science....


But my first thought is to list each route as a collection of points and then search for a match between the collections of points. This presumes that your routes are taking place on a gird with well defined points.
 
  • #3
140
1
I can't find a specific API function to determine if 2 routes overlap. However there is one that returns a route as a list of latitude/longitude pairs and you should be able to work it out from that.

https://developers.google.com/maps/documentation/javascript/directions

The algorithm to determine if 2 lines intersect is basic maths and is wikipedia

http://en.wikipedia.org/wiki/Line-line_intersection

If you actually need code for that, I am sure someone on stackoverflow can be persuaded to do it for some internet karma points.
 

Related Threads on How to determine whether a route overlaps another route in Google Map?

  • Last Post
Replies
2
Views
14K
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
20
Views
2K
  • Last Post
Replies
13
Views
1K
Replies
21
Views
1K
Replies
12
Views
2K
Replies
2
Views
3K
Replies
1
Views
2K
Replies
2
Views
5K
Replies
4
Views
5K
Top