I want to Develop a project where it will work with custom map. I have a image in SVG format which is a campus image. I want to get the user current location and show the path of user selected location.
I can't understand where to start. How it worked. I know how to work with Google Map.
Very less tutorials are available in web. So I am unable to get sufficient help from Google.
Thanks in advance.
You cannot get user location using .svg image. Vector images can be use as a map marker, icon, symbol or image to a polyline.
If you want to get current location, use FusedLocationProviderApi. FusedLocationProviderApi provides improved location finding and power usage and is used by the "My Location" blue dot.
To show path selected location, use Google Maps Android API to expose intents that you can to launch Google Maps in display. It allows you to display map in a specified location and zoom level, show directions, search for a location and display them on a map. Directions can be returned in driving, walking or bicycling.
Here's a sample demo app which discuss how to get current location and show direction to selected location: https://github.com/googlemaps/android-samples/blob/master/ApiDemos/app/src/main/java/com/example/mapdemo/MyLocationDemoActivity.java
Start your poject by following steps listed in Official Google Documentation for Maps Android API. Here is the link : https://developers.google.com/maps/documentation/android-api/start#step_3_create_a_google_maps_project
Related
I'm developing an app that tracks my location in real time, using FusedLocation API and Google Maps. I use a marker to show my current location.
My problem is that my location is always out of street, following parallel to the street while I move.
It does not seem an inaccuracy of GPS, but a discrepancy between the map and the location.
How can I fix this behavior?
Any help would be appreciated!
Try to use ACCESS_FINE_LOCATION instead of ACCESS_COARSE_LOCATION in the Android manifest permissions
https://developer.android.com/reference/android/Manifest.permission.html#ACCESS_FINE_LOCATION
Well gps data are not precise as they have a margin of error that allows them to be off the road. A solution to that is to snap the collected positions to the roads that are known to the api.
Here's a link to the docs that shows how to do that using the java api.
Note: For additional info, the page also gives an example for raw gps location and snapped locations superposed in an image right after the example code.
I am developing an app for local bus system and as per requirement, a bus can have multiple routes from one location to other. So i have to implement methodology like
fetch user's current location
get destination from user and accordingly show user all possible routes to destination
show all paths on map simulataneously with optimal shortest path highlighted with different color.
currently, I have progressed to basic application having functionality
get user's current location and pin point it with marker on google map
getting single path to destination (using google maps api)
plotting it on map by polyline. I have used one tutorial that implements navigation from source to destination.
Now I have to find all possible routes from source to destination. searched for answer but most answers referred to apply single path which I have already done. Any help will be much more appreciated.. Thanks in advance...
Use Google Directions API with parameter 'alternatives=true'.
Scenario :
In my android app, I have a Google Map that is showing me my friend's location. My friend and I can move from their position and I still want to get him (finding friend's location/updated_location is not an issue). To reach him fast, I am implementing navigation functionality to it.
Question :
How can I implement navigation to Google Map? I heard about OpenTripPlanner, but I'm not sure if I can use it in Google Maps.
As my friend's and my location can change, I want to update the navigation path from my current location to his current location. (An Idea I have is to recalculate the path when friend's location changes).
I also want to implement voice navigation to my app. How can I get this?
Any suggestion which will satisfy above requirement will be appreciated.
Please suggest sample code and working functions that can be used.
You can take a look at this blog post I wrote on implementing a navigation Polyline to your Google Maps API V2:
Google Maps API V2 Polyline Navigation
There you will find the needed method to get the navigation instruction from Google Directions API and to paint it on your map.
I am building a web app which contains a Google Maps link that can be opened by the native phone Maps app (iPhone/Android).
The link has the form:
http://maps.google.com/?q="+startCooLat+','+startCooLng;
and I have also tried the:
http://maps.google.com/?q=loc:"+startCooLat+'+'+startCooLng;
However in the native app the marker is positioned in the nearest street and not in the exact coordinates that I am giving. Is there a solution or another parameter to set so as to overcome this issue?
Instead of questioning (q=.....) google maps for the location, in which it returns what it thinks is the nearest human address to the location (somewhat annoying I think) you can pass a lat lng location where you want the center of the map to be. For example:
http://maps.google.co.uk/?ll=53.385517,-1.865315
Instead of:
http://maps.google.co.uk/?q=53.385517,-1.865315
I had this problem my self, and on my Android device at least this works. The second example simply puts the map on a road, the first is in the middle of the moors on the device in the maps app.
The full link from the comments:
http://maps.google.com/maps?ll=53.385517,-1.865315&q=loc:53.385517,-1.865315&t=m
This one seems to work at adding a marker for the standard maps app whilst still adding a marker.
After receiving a recent answer to an old Android Google Maps question I had, I have found another solution to this question, which I thought would be useful for others. Original Question - and credit to Captain Charmi for pointing me in the direction.
Instead of using the link above which will create a marker at the given location, trouble is, the maker is pretty meaningless, just the coordinates. If you use the following link, you can add either a title to the marker and show the coordinates:
http://maps.google.com/maps?q=53.385517,-1.865315+(My Random Location)
Or you can instead of adding a title, you can supply text to go inside the marker:
http://maps.google.com/maps?q=A pot of gold at the end of a rainbow#53.385517,-1.865315
As you can see, Google now drops the marker in the correct place due to being supplied the info for the marker. I hope this helps.
There is a Google map and on it marked objects. With GPS defining man's place on the map.
The aim is to set the phone automatically detects and plot a route to the nearest object. How can it be obtained?
I find this tutorial very helpful:
http://www.anddev.org/google_driving_directions_-_mapview_overlayed-t826.html