0

I am creating an android app which is notify location to get off from the bus. It shows bus route by using poly lines and when user enter the destination, it also shows the path from current location. My question is how can I get the location of intercept point. I have attached a screen shot here.enter image description here

Shanika
  • 1
  • 1

1 Answers1

0

This question is a bit ambiguous, I recommend you first search and show your effort (or code) or whatever you did to solve your problem and give more context,for instance, ¿are the routes are in lat,lng format? etc.

Regarding this, there is a lot of algorithms to acomplish what you are looking, like:

How to find if an intersection occurs between two line segments represented by a Latitude and Longitude

Efficient list intersection algorithm

or a mathematic aproach in case you want to programme it by youself:

http://www.wikihow.com/Algebraically-Find-the-Intersection-of-Two-Lines

IMHO I would pre-calculate the intersections points before, store it and then compare it with the realtime position (lat,lng) of the users. If the user is near one of the intersections (with algorithms like: How to calculate the bounding box for a given lat/lng location?), show it.

Hope it helps.

Community
  • 1
  • 1
JP. Aulet
  • 4,375
  • 4
  • 26
  • 39
  • I have load specific path by using markers and poly lines in google map. When user enters the destination location, it shows the path from current location to destination. So if I can take locations from ploy line using longitude and latitudes, I can get intersection point. (When longitude and latitude of defined bus route = longitude and latitude from user current location to destination ) so how can I get location from poly line using longitudes and latitudes – Shanika Apr 18 '17 at 16:15