Azure Maps Structured Address Lookup: Partial Postal Code Search

Tim Claason 21 Reputation points
2022-05-24T14:33:34.61+00:00

Using the Azure maps address lookup endpoint at https://atlas.microsoft.com/search/address/structured/json , it appears we get odd responses when doing a partial postal code search, particularly in the US. It seems to revert to searching for streetName when doing such a search. Does Azure maps offer that sort of search in any of its endpoints?

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
624 questions
{count} votes

Accepted answer
  1. IoTGirl 2,976 Reputation points Microsoft Employee
    2022-06-02T17:40:27.11+00:00

    Hi Tim,

    You would be best served to build a small database from https://en.wikipedia.org/wiki/List_of_ZIP_Code_prefixes rather than do an address search. You can then geocode based on the https://en.wikipedia.org/wiki/Sectional_center_facility for it to make more sense.

    You are trying to use an address API and that does not align with such a small result set so having your own small data set would make more sense. At 3 digit it would be less that 1000 entries.

    Sincerely,
    IoTGirl


1 additional answer

Sort by: Most helpful
  1. IoTGirl 2,976 Reputation points Microsoft Employee
    2022-05-26T15:05:52.347+00:00

    Hi Tim,

    Without the full structure of the call, I can't give a concise answer. We have found that postal codes that start with a number 1 or 2 can be aligned with a house number so it would be critical to use the specific designation to tell the geocoder that this is a postal code and for what country to disambiguate. For example the unstructured call:

    https://atlas.microsoft.com/search/address/json?api-version=1.0&query=10012 -> This is a postal code in the eastern US but also a typical house number, worldwide.

    As you are saying "Particularly in the US", are you designating the country in your call? Many places in the world have 5 digit building and postal codes so without clarification, the geocoder will do it's best but the more detail you provide, the more confident it can be.

    https://learn.microsoft.com/en-us/azure/azure-maps/geocoding-coverage

    For example you should be using https://learn.microsoft.com/en-us/rest/api/maps/search/get-search-address-structured and a call like:

    https://atlas.microsoft.com/search/address/structured/json?api-version=1.0&countryCode=US&postalCode=10012

    This tells the geocoder that you are providing a postal code in the US and then that information can be used to inform the result.

    Sincerely,
    IoTGirl

    1 person found this answer helpful.