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 :)
Related
Im trying to design a navigation app based on Google maps.
What I'm looking for is an article or any possible solution to let me be able to, given a polyline, which represents a route on the map, detect all interceptions between the polyline and markers on the map so that I can display for a distinct route how many and what kind of markers this route passes through.
Basically what I lm asking is if there is a way I can detect interceptions between my polyline(which represents a route) and the markers (which represent points of interest on the map, I e),
I've thought about using geofences but I can't find a method or a way that would allow me to get interceptions between polyline and geofences created over the markers, any kind of help would be appreciated.
Seems there is no specific method in Google Maps API, but if You have polyline points and marker coordinates, You can test for each marker and each polyline segment for marker on the polyline segment laying, for example by this way described by MrROY.
Update
You also can use PolyUtil.isLocationOnPath(LatLng point, java.util.List<LatLng> polyline, boolean geodesic, double tolerance) method form Google Maps Android API Utility Library to test intersection of Marker and polyline with tolerance precision.
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:
I'm using Google maps API v2 and I'm trying to figure out how I would allow a marker to be dropped on a SupportMapFragment and set the marked position to lattitude and longtitude variables.I have figured out how to get the path from two hard coded points but not this way.
I have come across this solution which is useful for adding markers How to show multiple markers on MapFragment in Google Map API v2? but not applicable for dropping a marker on the map fragment and translating the coordinates.
Does anyone have any pointers on doing this or where I would start with this implementation?
This is how the interface looks at present:
Assuming you mean, by drop a marker, to add a marker to the map by the users touch, you will find the answer here.
Add Marker on Android Google Map via touch or tap
I want to display markers like these below on my android map application. I Know I have to use custom marker for this I also have the angle calculated but I don't know how to display the arrow on the marker.
Any pointers will be helpful and Thanks in advance.
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.