How to get an address based on the postal code? Which api should I call? I didn't find the answer from google map platform。
Geocoder can't get the detail address
Try this API for fetching address based on pincode.
http://maps.googleapis.com/maps/api/geocode/json?components=postal_code:90210&sensor=false
Like others pointed out, in some cases there is a one to one correspondence between an address and a post code, like in Singapore where you can use geocode.xyz to convert between them: https://geocode.xyz/508260?region=SG
For USA, you need a zip+4 postal code, for example: https://geocoder.ca/10005-1971?geoit=xml
<standard>
<stnumber>4</stnumber>
<staddress>Wall St</staddress>
<city>New York</city>
<prov>NY</prov>
<postal>10005-1971</postal>
<confidence>0.5</confidence>
</standard>
Related
I am using the GeoCoder for getting lat and long coordinates by giving him street adress, post code, and country. I have only adresses for Germany.
There is a street called "Sandgrubenstraße" with its post code but he is adding a marker somewhere in Austria. But it should be added in Germany.
I found out, that there is the same street in Autria called "Sandgrubenstraße" but how does that work when I use the post code which is unique?
How can I prevent GeoCoder to add markers that are NOT in Germany? How can I restrict this behaviour ? Do you have an example?
Postcodes are not globally unique, different countries can and do have overlapping post codes and different standards. Adding the country name to geocode prevents this happening, so you should add "country" when filtering for address components.
components=country:DE should solve this.
I'm going nuts on this one. I used Places Autocomplete before and that worked like a charm. e.g: https://maps.googleapis.com/maps/api/place/autocomplete/json?sensor=false&location=53.6020,53.6020&input=mcdonalds&key=
Now I'm trying to use the search in a range of 1000m of the users location, but I keep getting ZERO RESULTS. Can someone see, what I can't?
https://maps.googleapis.com/maps/api/place/search/json?location=53.6020,53.6020&radius=1000&keyword=mcdonalds&sensor=false&key=
Thanx in advice!
You have to specify a type of search in your URL (i.e. /nearbysearch/, /textsearch/, etc)
try this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=53.6020,53.6020&radius=1000&keyword=mcdonalds&sensor=false&key=
Also, don't forget to append your API key to the URL :)
Lastly, for debugging purposes, try to use a different latitude,longitude coordinate and see if that works (i.e. use the lat/lng for New York City).
I have an question that while using Google Direction Api we can get the list of data like city's name, its Lat & Lng etc but the data provided by Api is limited to some extend. It's not able to provide all cities coming with-in that particular route.
E.g. If we try to go for Chandigarh to Delhi, then the route has a fixed result but when we try to reverse that same search i.e. Delhi to Chandigarh, some of the cities coming in previous result get vanished in api's new result, moreover, we just have a limited amount of locations/cities in result while we need the route completely detailed.
Do any of you guys faced this issue before? Is there any other way to match such requirement?
Hope I am understandable.
Thanks.
Use the below url:
https://maps.googleapis.com/maps/api/directions/json?origin="latvalue","longvalue"&destination="destnLat","destnLong"
&sensor=false&avoid=highways&mode=driving&alternatives=true
you have to set the alternatives value to true so it will result different routes available between the source and destination
When I entered a postal code in my Edittext and click on a button, I need to show a address list related to that particular postal code in a Spinner.
You need to use Geocoder class for your requirement. The thing you are asking in known as reverse-geocoding.
There is service provided by google.
http://maps.google.com/maps/api/geocode/json?address=&components=postal_code:15204&sensor=false
In the URl 15204 is the postal code. Make a call to the url with the postal code in place.
This returns a json format, parse the list of cities with the postal code.
Probably first result is what you are looking for.
As I am typing autocomplete address using http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address=** I would like to prioritize within that city any address that begins with the following name .For ex: if I type mount and priority is California then it should give back Mountain view as the recommendation answer.How do I do that .I really appreciate any help.PLease let me know with respect to the above api call.Thanks in advance.
See https://developers.google.com/maps/documentation/geocoding/#Viewports
The short of it is that you can add a 'bounds' parameter that specifies lat-lng points to hint to the geocoder that you wish to look within a particular area. An example from that page is:
http://maps.googleapis.com/maps/api/geocode/json?address=Winnetka&bounds=34.172684,-118.604794|34.236144,-118.500938&sensor=false