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

  • Thread starter Thread starter vivek91m
  • Start date Start date
  • Tags Tags
    Google Map
Click For Summary
To determine if two routes on Google Maps overlap, one suggested method involves representing each route as a collection of latitude and longitude points. While there isn't a direct API function for checking route overlap, the Google Maps Directions API can provide routes as lists of coordinates. The mathematical principle for checking if two lines intersect is straightforward and can be found on Wikipedia. For those needing implementation assistance, coding help can often be found on platforms like Stack Overflow.
vivek91m
Messages
8
Reaction score
0
I've two routes in google map:

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

How can I determine if these routes overlap or not?
 
Technology news on Phys.org
I don't 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.
 
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.
 
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
449
Replies
4
Views
2K
  • · Replies 19 ·
Replies
19
Views
960
  • · Replies 2 ·
Replies
2
Views
14K
  • · Replies 8 ·
Replies
8
Views
1K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K