There are a lot of different ways to do this as "central" is a bit ambiguous. Here are a couple examples of what "central polygon" could mean:
- Take the bounding box (or bounding circle) of all polygons you have and find the polygon that is in the center of that. It's possible that no polygon is under the center coordinate.
- Merge all the polygons together to create one big polygon, then find it's centroid and use that as there center. Again its possible that no polygon is under the center coordinate.
- There is a geospatial center and a visual center, these are not the same as the map projection stretches the more you move towards the poles. If your map displays all the data nicely, it is likely centered based on the visual center of the bounding box.
- Center could also be calculated based on the center of mass of coordinates, or based on distances between edges (e.g. Voronoi diagram).
For 1 and 2, a good example of when a center may not intersect a polygon is if the shape of the overall area is like a C. In your case, if no polygon intersects the "center" point, you could simply grab the nearest polygon.
Bing Maps does have a built-in spatial math library that could be used, however, given the recent retirement announcement of Bing Maps, relying on an open source like [Turf.js] would be smart and make it easy to migrate to Azure Maps in the future (Azure Maps is uses open data standards which work with tons of open-source libraries).
I've put together a code sample showing several different methods here: https://rbrundritt.azurewebsites.net/Demos/AzureMaps/PolygonCollectionCenter/index.html