i am getting a fully loaded map in my android app, and i am getting some directions waypoint using the directions API. What i would like to accomplish now is check if the desired route form A to B intersects with another polyline.
Can someone shed some light into this?
Thank you very much, cheers!
Loop for each straight line in first polyline
Loop for each straight line in second polyline
Test if both straight lines intersect. They both intersects if there exists one point that both line share.
Line equation if endpoints are known:
Related
When you draw a polyline, those points near the turns are not accurate while moving they are placed on the top of the buildings and sometimes instead of a proper polyline there is a line from the source to destination.What I want to do is a polyline must stick on to the road.So how do I fix this?
I am following this link:
Please find the screenshots for more clarification.
I'm developing an app in android using Google Map, I want to check if a marker is in direction from A to B or not ?
You can use the SphericalUtil.isLocationOnPath method from the Google Maps API Utility Library that, according to the Javadoc:
Computes whether the given point lies on or near a polyline, within a specified
tolerance in meters. The polyline is composed of great circle segments if geodesic
is true, and of Rhumb segments otherwise. The polyline is not closed -- the closing
segment between the first point and the last point is not included.
In an application I'm currently developing, I allow the user to draw his own way on a Google Map Android v2.
For that, I capture the onTouch / action_move event and I convert the x and y of the event to a Google Map LatLng. Then, with these LatLng I build a PolylineOptions that I finally add on the map.
Now, I would like to know if there is an intersection in this polyline and if it is the case, I would like to obtain the coordinate of this point.
Is there a way to do that ? Maybe by converting Polyline into Path and Region ?
I have try the latest proposition without success.
Thank you in advance for you help :)
I am using Google Map Api V2 and I can marker or draw a line between two points.But I try to draw a line through the route of a bus.So Route,Ways,Stopping places...etc of the bus are already known.First of all, I tried to find all LatLong values of the route and I draw it as polylines but I guess it is wasting time.So I want to draw line without find out all LatLong points of route of the bus.Is there any way ?
Thanks for the help..
You can use the Directions API to get the directions between two points, but this probably wont match your bus routes.
everyone...
I have something to ask about using a MapView in Android with Google Maps API..
I've read about how to make a Geopoint or more and find a distance between 2 points..
One thing that still makes me confuse is about calculating a distance between 2 points. I've tried and find the result but it's applied if the condition is when I want to make a straight line between those points. But, when I crosscheck with maps.google.com, the result (distance) is different with the same latitude and longitude of those points. And I realize that its a kind of a Driving Direction..
example of Google Map Web
If you see the picture, it's not a straight line so of course the distance is different. So how could I calculate this distance in Android in this case? And please show me the code to make it...
Yes it will return you the straight line distance between two point..
you can use Google direction API for this ...Here is the link for this.
http://code.google.com/apis/maps/documentation/directions/