Azure Maps Address Search result missing full zip codes for Canadian addresses

Jeff Haacke 40 Reputation points
2025-03-26T13:49:54.99+00:00

Another Canadian address issue I'm hitting with the Azure Maps API: I am now using the Address Search endpoint to validate passed-in address fields. The result payload of that endpoint includes an "address" object that has values for "postalCode" and "extendedPostalCode". For Canadian addresses, I'm finding that "postalCode" contains only the first 3 chars, and "extendedPostalCode" contains all 6. This is fine. However, there are some Canadian addresses for which the endpoint returns only the 3-char "postalCode" value, and "extendedPostalCode" is completely omitted from the result. Therefore, I am not given the full postal code back.

Example:

https://atlas.microsoft.com/search/address/json?&subscription-key=###&api-version=1.0&language=en-US&query=235 Main St E, Langham, SK S0K 2L0

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

Accepted answer
  1. rbrundritt 20,201 Reputation points Microsoft Employee
    2025-03-26T14:33:32.33+00:00

    Try using the latest Geocoding service: https://learn.microsoft.com/en-us/rest/api/maps/search/get-geocoding?view=rest-maps-2025-01-01&tabs=HTTP

    The older Search services have less data and limited logic compared to the latest geocoding service. When I try your query like this:

    https://atlas.microsoft.com/geocode?api-version=2025-01-01&query=235%20Main%20St%20E,%20Langham,%20SK%20S0K%202L0&subscription-key=xxx
    

    I get the following response:

    {
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "geometry": {
            "type": "Point",
            "coordinates": [-106.9576788, 52.3603168]
          },
          "bbox": [-106.966111569871, 52.3564540824293, -106.949246030129, 52.3641795175707],
          "properties": {
            "type": "Address",
            "confidence": "Low",
            "matchCodes": [
              "Good"
            ],
            "geocodePoints": [
              {
                "calculationMethod": "Rooftop",
                "usageTypes": [
                  "Display"
                ],
                "geometry": {
                  "type": "Point",
                  "coordinates": [-106.9576788, 52.3603168]
                }
              },
              {
                "calculationMethod": "Rooftop",
                "usageTypes": [
                  "Route"
                ],
                "geometry": {
                  "type": "Point",
                  "coordinates": [-106.9577071, 52.3602266]
                }
              }
            ],
            "address": {
              "addressLine": "235 Main St E",
              "streetName": "Main St E",
              "streetNumber": "235",
              "postalCode": "S0K 2L0",
              "locality": "Corman Park",
              "formattedAddress": "235 Main St E, Corman Park, SK S0K, Canada",
              "countryRegion": {
                "name": "Canada",
                "ISO": "CA"
              },
              "adminDistricts": [
                {
                  "shortName": "SK"
                },
                {
                  "shortName": "Division 11"
                }
              ]
            }
          }
        }
      ]
    }
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.