I'm developing an Android app to integrate with another app.
In this app I need get the current user location and send it to the other app.
I'm getting the latiude and longitude using the following web service:
https://maps.googleapis.com/maps/api/geocode/json?address=Rua+Vergueiro,+1883,+S%C3%A3o+Paulo,+Brazil&sensor=true
The problem is that when the other app receive the latitude an longitude and convert it to address description, an wrong address is showed to the user.
The other app is using the here.com web services to convert the latitude and longitude to address description and Im using googleapi.
Anyone knows tell me what may be happening?
Thanks.
You are geocoding using one service (i.e. Google) and reverse geocoding using a second service (i.e. HERE) and the underlying data is different for each one. As it happens, the location you are looking for is at a junction as shown here
If you run a reverse geocoding search for this location, then the closest location found by HERE is around the corner at Rua Jardim Ivone - the second closest result found by HERE is the same as Google - Rua Vergueiro. As you can see from the picture this is correct - the closest house on the map to the stated location given is actually around the corner.
Related
I have created simple android application which take current Latitude and Longitude from google api. then it will store that data to server.
My problem is that every time when i am try to get the Location it show me different value. same place and same phone then also it fetches different data.
this problem is very critical because i am doing some functionality based on the difference of the Latitude and Longitude.
can you tell me how can i get the same lat and long in each devices ?
Thanks in advance
Does it display huge differences or just ~50-100m differences? Because GPS isn't exact (plus it depends on connections, ...).
I have this code to start a navigation activity
String uri = "geo:0,0?q=<lat>,<long>";
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
Google Maps starts and show the correct location on the map but at the bottom panel, instead of the location name to find a route to, I see the latitude and longitude I've sent.
The lat/long data makes it certain about the location I want but shows this info while sending it the location name might show it as I expect but it might get confused with several similar locations. How can I solve this?
You can show a name in the marker in google maps using the following URI:
String uri = "geo:0,0?q=34.99,-106.61(Treasure)";
As explained in android documentation
Not quite sure I fully understand what you're asking for, but it sounds like you want Reverse Geocoding. You can convert your Lat/Lng to a location with it. It generally gives a very detailed response, usually including the street address number, so that's one way to distinguish similar locations.
I'm new to android programming and I'm wondering if it's possible and how to retrive from the current position (I don't even know how to retrieve it) the region and the province.
Could you please post some code or tell me where I can find it?
Thanks!!!!!!
Matteo
GPS TRACKING IN ANDROID PHONE:
You can retrieve current location of the mobile phone using Android Location Manager.
Tutorial Reference: GPS Tracking
REVERSE GEOCODING WITH AVAILABLE LAT LONG:
For getting the region and province, after getting current lat/long from phone, you can use the google reverse geocoding API that can be consumed via web-service.
The Google Reverse Geo-coding API is : https://maps.googleapis.com/maps/api/geocode/json?
Usage would be a GET REQUEST like : https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452
(You won't get a response if you just copy and paste the URL in browser)
(API Key is also not required for limited usage)
Reference : Reverse Geocoding
First, find the location of your user using the Location Manager.
Then, pass the location to Google's Geocoder for the address (it contains the state, province and more)
You can also use the methode of Geocode class's (android.location) : http://developer.android.com/reference/android/location/Geocoder.html
In my application I want to use the users' current latitude and longitude. I use the following example.
Still I did not get the answer.
Can emulator displays the latitude and longitude?
How shall i get latitude and longitude from the IP address??
quick response will help me a lot.
There are some different APIs you can use to get a IPs location. This post mentions a few.
Your linked answer uses GPS to get the current position. The Emulator does not have a working GPS-module, so when testing this in the emulator, you can add fake-data for the lat. and long. so you can test the code. More here: How to emulate GPS location in the Android Emulator?
If you want to get a location on an IP-address, you can use certain services for that. This has already been discussed here: What's the simplest way to get a user's latitude and longitude from an ip address
As mentioned in the linked post, I'm not sure about the accuracy of those services.
I dont think there is a possibility to return position data from an IP adress possibly the country but not pin point exact (altitude, longtitude) therefor you need to return device gps data wich is transfered though the internet but has nothing to do with an IP adress..
I have finally found my mistake. the example given HERE works fine.
And the mistake was mine. In the location Setting in my mobile, i forget to check the mobile networks option. once i checked tat option i got the latitude and longitude for my current location.
Try http://www.iptolatlng.com/ , it provides JSON and JSONP results
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