How to get Google GeoCode to recognize Private Bag addresses?

Anyone had experience getting the Google geocode API at:

"http://maps.google.com/maps/api/geocode/json?address="

to recognize a private bag address?

New Zealand Address, mainly for government departments.

I can't speak to how Google's geocoding API handles them, but I'm not sure that it necessarily makes sense to try to map a locked bag/private bag to a point, since, y'know, there often isn't a physical box or bag.

I understand that, I was just curious if it's possible to do so.

I'll just remove those lines from the data.

Sorry, I didn't mean to discourage you! One approach you could take is to remove the 'Locked/private bag' line of the address and just feed the suburb/state/country/postcode parts of the address into the API. It can definitely return results for localities or 'neighbourhoods'. For example:

http://maps.google.com/maps/api/geocode/json?address=St%20Kilda%20VIC

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Saint Kilda",
               "short_name" : "St Kilda",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Port Phillip City",
               "short_name" : "Port Phillip",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "Victoria",
               "short_name" : "VIC",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Australia",
               "short_name" : "AU",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "3182",
               "short_name" : "3182",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "St Kilda VIC 3182, Australia",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : -37.852189,
                  "lng" : 144.9932622
               },
               "southwest" : {
                  "lat" : -37.8762914,
                  "lng" : 144.9706529
               }
            },
            "location" : {
               "lat" : -37.864,
               "lng" : 144.982
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : -37.852189,
                  "lng" : 144.9932622
               },
               "southwest" : {
                  "lat" : -37.8762914,
                  "lng" : 144.9706529
               }
            }
         },
         "place_id" : "ChIJiSM5Zmho1moR4NqMIXVWBAU",
         "types" : [ "locality", "political" ]
      }
   ],
   "status" : "OK"
}
1 Like