Calculate number of roads/lines a line crosses

  • Context: Undergrad 
  • Thread starter Thread starter Rich2020
  • Start date Start date
  • Tags Tags
    Line
Click For Summary
SUMMARY

The discussion centers on calculating the number of roads a user-drawn line crosses using Google Maps. The user seeks assistance in determining intersections between the drawn line and multiple roads, leveraging the Google Directions service to identify the nearest road to a marker. The challenge lies in applying mathematical concepts, such as the Pythagorean theorem, to multiple road intersections effectively.

PREREQUISITES
  • Understanding of geometric principles, specifically line intersection calculations.
  • Familiarity with Google Maps API and its Directions service.
  • Basic knowledge of programming, particularly in Python for implementing calculations.
  • Experience with coordinate systems and mapping technologies.
NEXT STEPS
  • Research how to use the Google Maps API for detecting line and road intersections.
  • Learn about computational geometry algorithms for line intersection detection.
  • Explore Python libraries such as Shapely for geometric operations.
  • Investigate the use of Pythagorean theorem in multi-line intersection scenarios.
USEFUL FOR

This discussion is beneficial for developers working with mapping applications, geospatial analysts, and anyone involved in creating interactive map features that require line and road intersection calculations.

Rich2020
Messages
4
Reaction score
0
Hi guys,

I have a really tricky problem here and I'm hoping that there is a math guru here who can help.

The problem

Using Google maps, I need to allow a user to draw a line. This line can be in any direction and basically, I need to determine if the user has drawn the line over a road and if so, how many.

Below is an example:
The image doesn't seem to be showing so here is the link: http://postimg.org/image/iuj9e8jfj

With Google Directions service, I am able to get the nearest road of the dropped marker (markers indicated by arrow in image).

For a single road, I believe that I can do this with Pythagoras, but for multiple roads by brain starts to boil.

If anyone here could help, I'd really appreciate it. I appreciate it is pretty tough so I'm open to all suggestions.

Thanks!
 
Last edited by a moderator:
Mathematics news on Phys.org
I really don't understand what you want to do. Do you want to calculate he number of roads the line is intersecting?
 
adjacent said:
I really don't understand what you want to do. Do you want to calculate he number of roads the line is intersecting?

Yes, exactly that :)
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
4K
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
Replies
5
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 73 ·
3
Replies
73
Views
6K
  • · Replies 16 ·
Replies
16
Views
4K