Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm currently using Google Geocoder API to determine location data for my web service. It's important for me to get the postal code for a given country and city, but it's look like that Google is limiting the result.

Here's the API call:

http://maps.googleapis.com/maps/api/geocode/json?address=deutschland,+saarlouis&language=de&sensor=false

The result is like that:

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Saarlouis",
               "short_name" : "Saarlouis",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Landkreis Saarlouis",
               "short_name" : "Landkreis Saarlouis",
               "types" : [ "administrative_area_level_3", "political" ]
            },
            {
               "long_name" : "Saarland",
               "short_name" : "SL",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Deutschland",
               "short_name" : "DE",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "Saarlouis, Deutschland",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 49.36187570,
                  "lng" : 6.815549499999999
               },
               "southwest" : {
                  "lat" : 49.26046930,
                  "lng" : 6.67501510
               }
            },
            "location" : {
               "lat" : 49.31346060,
               "lng" : 6.752286499999999
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 49.36187570,
                  "lng" : 6.815549499999999
               },
               "southwest" : {
                  "lat" : 49.26046930,
                  "lng" : 6.67501510
               }
            }
         },
         "types" : [ "locality", "political" ]
      }
   ],
   "status" : "OK"
}
share|improve this question

3 Answers 3

Using the Official Drag Markers Geocoder - you have German Postcodes displayed.

enter image description here

http://gmaps-samples-v3.googlecode.com/svn/trunk/draggable-markers/draggable-markers.html

(zoom to Germany or change the source code and set the bounds to Germany)

share|improve this answer

The Google Geocoding API has usage limits.

Use of the Google Geocoding API is subject to a query limit of 2,500 geolocation requests per day. (User of Google Maps API for Business may perform up to 100,000 requests per day.) This limit is enforced to prevent abuse and/or repurposing of the Geocoding API, and this limit may be changed in the future without notice. Additionally, we enforce a request rate limit to prevent abuse of the service. If you exceed the 24-hour limit or otherwise abuse the service, the Geocoding API may stop working for you temporarily. If you continue to exceed this limit, your access to the Geocoding API may be blocked.

You might want to try setting up your own geocoder using Gisgraphy or something similar. That way you won't be affected by usage limits.

share|improve this answer
    
Oh yes, i read about that. I played around with Gisgraphy for an alternative to Google's services. Gisgraphy looks great but the also for areas of big cities in Germany there are no postal codes. –  user1044195 Sep 21 '12 at 7:48
    
How many requests are you making? You might want to track that. Or use Google Maps API for Business. –  R.K. Sep 21 '12 at 9:10
    
Currently my problem is not to be limited by maximal requests per day (for the free version). I'm just wondering why google doesn't tell me the postal code for a location. But thank you about your hint about request limitation :-) –  user1044195 Sep 21 '12 at 15:15

The reason you don't get the postal code is the query is too broad. If you would add a street name to the query the result will contain a postal code. A solution to your problem if you don't have a street name or don't want to use it is to split the geocoding into two parts:

Step 1: Use the city to get the GPS coordinates

https://maps.googleapis.com/maps/api/geocode/json?address=amsterdam

Step 2: Use the the GPS coordidates to get the postal code

https://maps.googleapis.com/maps/api/geocode/json?latlng=52.3182742,4.7288558

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.