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

In summary, the conversation discusses two routes on Google Maps and how to determine if they overlap. The suggested solution is to list each route as a collection of points, and use basic math to determine if the lines intersect. An API function and a Wikipedia link are provided as resources for further assistance.
  • #1
vivek91m
8
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
  • #2
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.
 
  • #3
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.
 

1. How do I determine if one route overlaps another route in Google Maps?

To determine if one route overlaps another route in Google Maps, you can use the "Avoid highways" feature. If the two routes overlap, the route may appear to have a gap or jump when the "Avoid highways" feature is turned on.

2. Can I use Google Maps to compare multiple routes and see if they overlap?

Yes, you can use the "Compare with selected route" feature in Google Maps to compare multiple routes and see if they overlap. This feature allows you to see all the routes on the same map and easily identify any overlapping sections.

3. How do I determine if a route overlaps a specific area or landmark in Google Maps?

To determine if a route overlaps a specific area or landmark in Google Maps, you can use the satellite view and zoom in to see the route more clearly. You can also use the "Measure distance" feature to see the exact overlap between the two routes.

4. Is there a way to check if two routes overlap without actually plotting them on Google Maps?

Yes, you can use the Google Maps Directions API to get the coordinates of the two routes and then use a mathematical algorithm to determine if they overlap. However, this method may not be as accurate as visually checking on Google Maps.

5. Can I use Google Maps to determine if a route overlaps with a restricted area or a one-way street?

Yes, Google Maps has a "Traffic" layer that shows current traffic conditions, including one-way streets and restricted areas. You can toggle this layer on and off to see if your route overlaps with any restricted areas or one-way streets.

Similar threads

  • Classical Physics
Replies
10
Views
724
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
21
Views
2K
  • Programming and Computer Science
Replies
4
Views
1K
  • General Engineering
Replies
12
Views
685
  • General Discussion
Replies
10
Views
1K
Replies
10
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
12
Views
3K
  • Programming and Computer Science
Replies
4
Views
2K
Back
Top