Draw path on google map during Driving/Walking - android

I am working on the application that require the draw the path on the google map. Here Starting point is the current location(latitude and langitude) of the user and when user change the place(walking/Driving) then as per the moving position get the user's current location(latitude and langitude) and draw the path on the google map as per the user's location.
I able to draw path between fix point.For that I am refer this LINK.
Thanks.

Use the Android Location API an example: http://www.vogella.com/articles/AndroidLocationAPI/article.html
and when you get your position, send the coordinates to google maps with an overlay for example.

Related

How to show custom locations in google map in flutter?

I have some locations stored in firebase and when the user wants the location it should display those locations in Google map. how can I show those locations in google map that is integrated with my flutter app?
It depend if you want only move camera to wanted location or if you want to display location on map using Marker.
Either way, you will need to get these locations from firebase to your app.
For adding Markers to your map follow these guidlines. If you want only changing camera position try method animateCamera() GoogleMapController.

Redraw route on map when user changes driving route

I'm working on an Android App which draws path on map using Polyline options, between source to destination.
This works fine.
What I need is, if user starts from source, and instead of taking drawn route towards destination, the user takes another route, the path on map should be redrawn for user's current path.
I'm using Directions API for drawing path.
I think, I'm required to use Google Navigation API. How can use that within my app, without having to navigate to Google Maps app?
First: Check if your current/last known location is near or falls on the path/route created.
Direction api: check if a place falls in the route path between 2 places
Second: If current/ last known location if outside or off the path/route created, send a request to get direction from the current location to the same destination.
OR
Try this
Turn by Turn navigation

How to draw path from current location to user entered location on map fragment?

I'm curious if there is a way to draw the path from a devices current location to a user entered location.From researching the only methods I have come across are to get path from lat and long coordinates like this solution http://blog-emildesign.rhcloud.com/?p=822 ,
My question is if there is a way to combine a users geo location and a user entered destination string to draw the path.I'm guessing this would involve reverse geo coding or am I wrong?
The current interface looks like this and I'm using Google maps API v2:
Look here for how to do a polyline in android map api v2 https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Polyline
Tip save your line as a kml file for interoperability so other apps will be able to import the file and show the same line on a map.

Trace the location only on Road in Google maps V2 android

I want to show the current location of the user only on road(not beside of the road) while moving. I have used the LocationManager to get the current location. But sometimes I am getting the location beside the road, with this, the location point on map is showing beside the road. Actually, I have to show his location on Road(if he is beside the road) only. I searched lot for this but didn't get any idea.
Example: How I am getting the current locations on map.
m
A---n-------B
here, A is start point
B is end point
n is on road(current location for sometime)
m is beside road(current location)
But I would need the m also should be on road.
Please help me on this..
The google directions service will calculate from nearest road so calculate directions from current location to current location - returned starting location will be on a road.
But what if user genuinely is off-road in a shopping mall carpark for instance?
For that you need to use road API which will give you the path upon the road otherwise you will not get the accurate path.
Snap to Roads
The Google Maps Roads API takes up to 100 GPS points collected along a route, and returns a similar set of data, with the points snapped to the most likely roads the vehicle was traveling along. Optionally, you can request that the points be interpolated, resulting in a path that smoothly follows the geometry of the road.
Check Details Here
You need to call like this
https://roads.googleapis.com/v1/snapToRoads?path=-35.27801,149.12958|-35.28032,149.12907|-35.28099,149.12929|-35.28144,149.12984|-35.28194,149.13003|-35.28282,149.12956|-35.28302,149.12881|-35.28473,149.12836&interpolate=true&key=YOUR_API_KEY

Reverse Geocoding in Android : Error "IOException:Service not Available"

My app is totally based on maps. The requirement is user need to enter the source and destination in words then i need to draw the route on map with those values with markers. Later on the displayed map with route drawn, the user able to change/modify the source or destination by dragging the marker which are displayed. Simultaneously the route drawn should also change dynamically with user's action.
I can get the lat & long from the map using onTouchEvent. But in the same map not able to set both source and destination.
And i tried reverse geocoding to get the lat & lon from given location names. But i get IOException:Service not Available. I was searching for solution, then i found this link which started in jun 2010, still no fix for this bug till now.
Please help.Also provide sample code.
Thanks.

Categories

Resources