E9.2 Google Maps API

Stank1964

Well Known Member
I want t verify a zip code in a state and I would like to use the google maps API to do it. My request would look something like this and pasting this into by browser with a valid API key will return exactly what I want - the state where that zip code exists. Has anyone done this with an Orchestration? The address parameter in the URL is zip code 21220 which is just outside of Baltimore.

https://maps.googleapis.com/maps/api/geocode/json?address=21220&key=API_KEY

Thanks in advance for your thoughts.
 
I did googlemaps api way back when fusion maps were a thing-- I assume they've moved the bar quite a bit from where I was.

If you don't mind me asking, what are you paying for this? It used to be really affordable, cheap even.
 
Yeah, it cheap, Geolocation 5USD for 1.000 request, and Address Validation 17USD, and more request more cheap: https://developers.google.com/maps/...on/reference/rest/v1/TopLevel/validateAddress

I haven't worked with google apis (only embed google maps into address book master), but it should be easy of implement with a connector. Check documentation and json request and response. For geolocation: https://developers.google.com/maps/documentation/geocoding/requests-geocoding and for address validation: https://developers.google.com/maps/...on/reference/rest/v1/TopLevel/validateAddress

I'm sure should be a lot of free or cheaper API for PostalCode.

In your case for geocoding request, you should get "postcodes_localities" from "result" json
1718184496575.png

JSON:
{
    "results": [
        {
            "address_components": [
                {
                    "long_name": "21220",
                    "short_name": "21220",
                    "types": [
                        "postal_code"
                    ]
                },
                {
                    "long_name": "Middle River",
                    "short_name": "Middle River",
                    "types": [
                        "locality",
                        "political"
                    ]
                },
                {
                    "long_name": "Baltimore County",
                    "short_name": "Baltimore County",
                    "types": [
                        "administrative_area_level_2",
                        "political"
                    ]
                },
                {
                    "long_name": "Maryland",
                    "short_name": "MD",
                    "types": [
                        "administrative_area_level_1",
                        "political"
                    ]
                },
                {
                    "long_name": "United States",
                    "short_name": "US",
                    "types": [
                        "country",
                        "political"
                    ]
                }
            ],
            "formatted_address": "Middle River, MD 21220, USA",
            "geometry": {
                "bounds": {
                    "northeast": {
                        "lat": 39.3888059,
                        "lng": -76.315579
                    },
                    "southwest": {
                        "lat": 39.2935808,
                        "lng": -76.474946
                    }
                },
                "location": {
                    "lat": 39.3514892,
                    "lng": -76.37530459999999
                },
                "location_type": "APPROXIMATE",
                "viewport": {
                    "northeast": {
                        "lat": 39.3888059,
                        "lng": -76.315579
                    },
                    "southwest": {
                        "lat": 39.2935808,
                        "lng": -76.474946
                    }
                }
            },
            "place_id": "ChIJRa0dDy3jx4kR9pPulj7N3tE",
            "postcode_localities": [
                "Bowleys Quarters",
                "Chase",
                "Middle River",
                "Rossville"
            ],
            "types": [
                "postal_code"
            ]
        }
    ],
    "status": "OK"
}

And with validate address:
1718185294687.png
JSON:
{
    "result": {
        "verdict": {
            "inputGranularity": "OTHER",
            "validationGranularity": "OTHER",
            "geocodeGranularity": "OTHER",
            "hasInferredComponents": true
        },
        "address": {
            "formattedAddress": "address, Middle River, MD 21220, USA",
            "postalAddress": {
                "regionCode": "US",
                "languageCode": "en",
                "postalCode": "21220",
                "administrativeArea": "MD",
                "locality": "Middle River",
                "addressLines": [
                    "address"
                ]
            },
            "addressComponents": [
                {
                    "componentName": {
                        "text": "21220"
                    },
                    "componentType": "postal_code",
                    "confirmationLevel": "CONFIRMED"
                },
                {
                    "componentName": {
                        "text": "USA",
                        "languageCode": "en"
                    },
                    "componentType": "country",
                    "confirmationLevel": "CONFIRMED"
                },
                {
                    "componentName": {
                        "text": "Middle River",
                        "languageCode": "en"
                    },
                    "componentType": "locality",
                    "confirmationLevel": "CONFIRMED",
                    "inferred": true
                },
                {
                    "componentName": {
                        "text": "MD",
                        "languageCode": "en"
                    },
                    "componentType": "administrative_area_level_1",
                    "confirmationLevel": "CONFIRMED",
                    "inferred": true
                }
            ],
            "unresolvedTokens": [
                "address"
            ]
        },
        "geocode": {
            "location": {
                "latitude": 39.3514892,
                "longitude": -76.3753046
            },
            "plusCode": {
                "globalCode": "87F59J2F+HV"
            },
            "bounds": {
                "low": {
                    "latitude": 39.2935808,
                    "longitude": -76.474946
                },
                "high": {
                    "latitude": 39.3888059,
                    "longitude": -76.315579
                }
            },
            "featureSizeMeters": 10720.366,
            "placeId": "ChIJRa0dDy3jx4kR9pPulj7N3tE",
            "placeTypes": [
                "postal_code"
            ]
        },
        "uspsData": {
            "standardizedAddress": {
                "firstAddressLine": "ADDRESS",
                "cityStateZipAddressLine": "MIDDLE RIVER MD 21220",
                "city": "MIDDLE RIVER",
                "state": "MD",
                "zipCode": "21220"
            },
            "dpvFootnote": "A1M1",
            "postOfficeCity": "MIDDLE RIVER",
            "postOfficeState": "MD"
        }
    },
    "responseId": "222d266d-4764-4017-80df-dd19e6a882b9"
}

Regards.
 
The terms of use for the USPS is it has to be for a map application. I guess they don’t want batch address validations hammering their servers. We chose google based on that. One business I work with pays google like $45 a month for geolocation api calls.
 
Yeah-- and USPS's batch address validation service was a joke at the time. You had to pay a monthly fee and they'd send you CD-ROMS full of text files so you had to import locally. And it was only for US addresses and maybe canada IIRC.
 
The terms of use for the USPS is it has to be for a map application. I guess they don’t want batch address validations hammering their servers. We chose google based on that. One business I work with pays google like $45 a month for geolocation api calls.
We have used Google Map APIs for years w/o any issues in several of our internal applications. Reasonably priced as well.
 
Back
Top