Azure Map showing postal code on incorrect country

David Fombella Pombal 5 Reputation points
2023-09-07T08:16:36.9966667+00:00

Hi all I am using Azure Maps component on Power BI , in Spain Postal Code of Barcelona is 08000 but it is displaying it on north of Malasia.

It is using a Hierarchy drill down from country.... ES international code of spain.

regards

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

2 answers

Sort by: Most helpful
  1. David Fombella Pombal 5 Reputation points
    2023-09-28T12:44:35.7266667+00:00

    Hi all,

    Using a column country code with value ES with Country or Region as Category

    And a postal code ( codigo postal in spanish column name) with category Postal Code.

    • ES Country Code
    • 08000 Postal Code

    Points a location in Malaysia please see image

    badmap

    0 comments No comments

  2. rbrundritt 15,471 Reputation points Microsoft Employee
    2023-10-02T17:59:04.01+00:00

    Doing a bunch of testing here is what I found:

    • Using the data provided, but only selecting the "OrgID_Land" column shows NO shows the country of Norway, a county result for SE appears in Laos, ES shows the state/province of "Esprito Santo, Brazil" who's commonly admin district code is "ES".
    • Setting the data category on this column helped with ES, SE disappeared for some odd reason. Note that there is "County" and "Country" data categories. If you select "County" by accident, you end up with very odd placements (I did this).
    • Adding the "OrgID_PostnrLevering" column after the "OrgID_Land" column made no difference. Reordering this so "OrgID_PostnrLevering" column was first resulted in points in Ohio, Tunsia, and Slovenia. Digging into this I found that the input postal codes also exist in these locations. Postal/zip codes are not unique and there are many that are reused in several countries. It appears that these values are being geocoded on their own without the country code and the top global result is what is being chosen. Setting the data category made no difference.
    • Renaming the columns in the data set "Country" and "Postal Code" without setting column data category resulted in NO and ES appearing in the correct place. The same behavior with switching the country/postal code column ordering in the Location field was observed.
    • Changing the values in "OrgID_Land" from country ISO codes to country names resulted in all countries being displayed correctly. Adding a column in your data set that maps ISO codes to country name and using that column for placement would be a good solution here. Many country ISO codes are also the codes used for different admin districts in many places in the world (e.g. CA is both used for Canada as a country, and California as a state). The geocoder behind the scenes tends to favor results that are for more precise locations (state results are higher priority than country results).

    Note that the Azure Maps visual is not doing the geocoding / border retrieval, there is an underlying geocoding capability in Power BI that was put in place long before the Azure Maps visual was created with the original map visual (Bing Maps). If you use that older visual, you will see the exact same behavior.

    Generally, I avoid using text inputs with the map visuals in Power BI as there are many limitations:

    • Each time a user loads the map it has to geocode all these locations which is very inefficient. Once geocoded, some location data is cached in the users browser for faster loading next time they load the visual, but it still does more processing than using latitude/longitude values. Geocoding data ahead of time is a general best practice for location data, well beyond just Power BI.
    • Due to the above, Power BI has a lower limit to the number of columns it will display on a map when text inputs are used rather than latitude/longitude.
    • The main purpose of multiple text inputs in these visuals is to power the drill down capabilities for locations that have boundaries. If you don't need that, it will only cause headaches.

    If you are trying to create the drill down effect here is some insights on how it works:

    • Its goal is to create a hierarchy based on the inputs; country -> adminDistrict1 (state/province) -> adminDistrict2 (county) -> postal code
    • To display the borders the Bing Maps geodata data API: https://learn.microsoft.com/en-us/bingmaps/spatial-data-services/geodata-api This API takes the input query, geocodes it and takes the first result and returns its boundary. Power BI passes in the columns individually into this so it can try and create a hierarchy of borders. This is often the primary source of issues since the postal codes you are looking for are not the top global results, and in this case do not align with the country borders. Unfortunately, this has been a known issue for many years. This functionality needs some adjustments along with exposing some options to tweak how it works. That has been a feature request for many years.