Plot postal codes provided in ranges.

Balasaheb Molawade 136 Reputation points
2025-06-18T12:55:12.3366667+00:00

Hi,

We are currently using Bing Maps and have received a requirement from our customers to plot postal codes on the map. However, instead of providing individual postal codes, they will provide in a range format, such as 21070–21199.

The requirement is to plot all postal codes that fall within the specified range. We would like to know if there is any way in Bing Maps to achieve this functionality — i.e., to plot all postal codes within a given range like 21070–21199.

We look forward to your response.

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

2 answers

Sort by: Most helpful
  1. IoTGirl 3,696 Reputation points Microsoft Employee Moderator
    2025-07-06T19:31:15.1433333+00:00

    Hi @Balasaheb Molawade

    This seems like a duplicate of https://learn.microsoft.com/en-us/answers/questions/2287515/fetching-multiple-boundaries-using-the-bing-maps-a where you were told that you will have to loop through the various individual Zip codes to pull back the polygons. If not, can you please add clarity as to the difference in this question?

    Sincerely,

    IoTGirl

    0 comments No comments

  2. rbrundritt 20,931 Reputation points Microsoft Employee Moderator
    2025-07-07T17:13:24.2533333+00:00

    With Bing Maps, as IoTGirl recommended, you could fetch multiple boundaries from the REST API's, however, there are likely a lot of zip codes that don't exist in the range you specific and thus will fail. If the range is small (a couple under values), this might not be too difficult to work handle.

    That said, this is a great scenario for using vector tiles, which Azure Maps supports natively, but Bing Maps doesn't. Even more so if you leverage PMTiles as you wouldn't even need a custom REST service to make the tiles available. This scenario could be achieved in Azure Maps with less than a couple dozen lines of code and would be extremely low cost. I actually threw an Azure Maps sample of this together in about 10 minutes. You can try it here: https://rbrundritt.azurewebsites.net/Demos/AzureMaps/PMTiles/FilteredZTCA.html
    It would be fairly easy to extend this sample to support swapping between different data layers and supporting filtering on them, or even overlaying and filtering multiple data layers. This sample is using a simple PMTile file as a data source, which is a static file which is very cheap to host. The serving costs of a million tiles from this would be a couple of dollars.
    If I tried to get the above solution to work in Bing Maps, it would take several thousand lines of cod, and likely require doing unsupported things to create a custom data layer to render the PMTiles as vector tiles.

    I know you are using Bing Maps, but you have asked a lot of questions on here where Azure Maps would have been a lot easier and likely still would be. The basic version of Bing Maps was just retired the other day. So it would be good to start making your plans for making the transition. Is there any specific technical reason/limitation in Azure Maps that might be preventing this? Knowing these now will give the team a chance to look into them to ensure a smoother transition for you in the future.


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.