Plotting boundary issue

Balasaheb Molawade 136 Reputation points


We have encountered a strange issue when plotting postal codes. For instance, when we input certain postal codes and Bing Maps is unable to locate the correct area, it generates random polygons, resulting in incorrect boundary. During testing, when we input random irrelevant text, Bing Maps still generates polygons, leading to incorrect boundary.

We are able to replicate this issue on Bing map SDK.


Interestingly, removing the 'USA' text resolves this issue, as it prevents the generation of boundary . This behavior aligns with our expectations: if Bing Maps cannot identify the exact boundary, it should refrain from generating any boundary.

Does anyone have a solution for this problem.


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

1 answer

Sort by: Most helpful
  1. rbrundritt 16,466 Reputation points Microsoft Employee

    I was never a fan of how the Spatial Data Services GeoData API works. When you pass in a query, it gets geocoded and its coordinates are used to find an intersecting polygon of the specified entity type. In most cases this works find, but in some cases, the geocode coordinate may not be over it's polygon, often due to the complex shapes of the polygon (e.g. the center of a C shaped polygon, or a situation where a postal code is represented by multiple disconnected polygons which is fairly common).

    So, in your scenario what is happening is the geocoder is matching on USA and ignoring the "tttttttttt", likely with a low match score, then taking the coordinate for the USA (somewhere in Kansas likely) and picking the zip code boundary that intersects with it.

    I believe the original reasoning for the service working this way was to provide support for hierarchy. For example, you pass in a street address, then you can ask for the boundary of any of the entity types.