Displaying user current location on map with phoneGap - android

I am trying to displaying a user current location on a map using phoneGaps getCurrentPosition function but I don't just want the users latitude and longitude I want their actual location example state they are current in, street name, country name ect. If anyone could point me in the correct direction I would greatly appropriate it (ebooks, weblinkes, blog post, code snippets anything). Thanks

You're going to need to reverse geocode the lat/lng into an address. Google has an API for that: https://developers.google.com/maps/documentation/geocoding/#ReverseGeocoding

Related

how to find exact source location on google map in android

In my app, there is a search box, user can enter any specific location, and i have to show that exact location on map. I searched a lot but not getting the exact answer. Please give your suggestions.
Google cannot give you location values for some vague locations. May be you can fetch all the locations from "https://maps.googleapis.com/maps/api/place/autocomplete/json" API. use the predictions and set to autocomplete textview.Once they select any location you can reverse geocode the location and get latitude and longitude values from that and set it to map.

Marking places in android app not on the 'Google Places' database

I want to add markers on map for my android app. I do know how to do it (overlay items). My question is: Since I am manually putting markers on points(on the map) whose lat/long's I already know, I want to know if there is any way to get the exact latitude and longitude of a place on google map? Right now I am asking my people to go to the particular places and use this ( http://bit.ly/K4fOcy ) app to determine the lat/long of that place and send it to me via e-mail. I use these lat/long values to put markers on my map in the app. But the latitudes and longitudes i get are not accurate. they have around 300-2500m error (on real scale).
Or shall I use the Google Places API? How does it work? What about the places which are not in the Google Places database? How do I exactly mark them on the map? I would be very grateful if someone points me in the right direction.
Thanks
If you are working with establishments that aren't represented in the Google Places API and want to be able to pull coordinates directly from http://maps.google.com/, you simply:
Find the location of interest on the map, using an address or just knowledge of the area
Right-click on the map and select What's here? from the context pop-up menu
The Lat-Lng coordinates will be automatically populated in the search input box and usually, the address will also be displayed in the dynamic side-panel (and very often a Street-View photo).
If you are looking for a way to query for the coordinates, you can use the Geocoderdev-guide service to turn addresses into coordinates.
Have you looked at the geocoding API for google maps? It allows you to pass in an address, and returns a Latitude/Longitude pair in response, there is an accuracy value returned with each response to let you know how close the geocoder was able to resolve the location. https://developers.google.com/maps/documentation/geocoding/

Android : How can I find location using just PINCODE?

I am trying to get location using PINCODE/ZIPCODE ex:560001 (Bangalore pincode).I am getting the location when I enter the ADDRESS , STATE & COUNTRY, but unable to get using pincode/zipcode. It displays UNKNOWN address.. can we find LOCATION using PINCODE ??
You can find a location (latitude, longitude) using any piece of address information but at the cost of accuracy.
Now obviously you can have a lat long corresponding individually to a
country, state, city, zip , address, etc and each will be more and more accurate, the more information you use.
Having said that, which GPS app are you using and to do what?
If the task is to find say restaurants, providing pincode should be enough.
but if you want to route from point A to point B , providing destination pincode will be hardly useful it wont pin point your exact location.
UPDATE
You can find points of interest like restaurants, banks etc, you can use google places api. You can search by just providing the pin code. refer to the following documentation:
https://developers.google.com/maps/documentation/places/#PlaceSearches

Positing user current location

first i would love to thank you for help me,i am develop the android application that contain 3 activities one of them is map.i am using google maps
what i want : 1- when the user open the activity (map) it shows the user her location not the coordinate 2- the user also can be able to positing(pining) any place by using pin and my app must store the coordinates for this pin in variable so i can use it later. PlEASE HELP ME
You should first obtain the user latitude and longitude. Then use the GeoCoder to obtain the address.
You have the complete code here , https://stackoverflow.com/a/3145655/563306

Sort Google Places API Data based on the nearest place to user

I am currently developing an app for getting nearest banks and atms from the current location of user. I am successfully getting all the details from Google Places API but now i wish to sort them according to nearest to the user. Right now it is giving me random means the first results which i am getting is not nearest to user. I want that the first data and others are sorted on the basis of distance from users current location.
If anyone has idea then please kindly help me.
Thanks!!!
There is an additional option rankby=distance which you can add as a parameter in the URL.
Please go through the Google Places API documentation for further details. I think it will be of use.
First try to current latitude and longitude of the end user and bank or ATMs.
Then, calculate the distance between (the current location and all the banks and ATMs) both of them with the method distanceTo().
Store the distance in the hashmap or arraylist as convenient to you.
Then, sort this distance. Whichever distance is less, retrieve it. It will be the nearest place.
Use this.
float dist = user_location.distanceTo(bank_or_atm_location);

Categories

Resources