Question

Is it possible in Bing or Nokia maps to display a blank map of the world where each country is only outlined by its border, and then fill some countries with a solid color? Thanks!

Was it helpful?

Solution

You can render arbitrary polygons on top of Bing maps, but there's no built in functionality to render regions like provinces, states, counties, etc. In order to highlight a region you would need to provide all the points of a polygon and overlay it over a region on the map. Here's a great article that discusses drawing "advanced" polygon shapes with version 7 of the Bing Maps AJAX control.

“Advanced Shapes” (i.e. Donut Polygons) on Bing Maps

A possible duplicate question in regards to Bing maps API

Bing map - highlight country with a polygon on hover

OTHER TIPS

A recent blog post on developer.here.com announced that:

The Geocoder API now supports the retrieval of admin boundary shapes (multi-polygon coordinates) with geocoding results. This feature is available for all countries & territories - in line with the country's depth of coverage.

The HERE Community Examples on GitHub offers a web-based example showing this. It is written in JavaScript but should give you the idea.

  1. Make http request to the REST Geocoder service using the additionaldata=IncludeShapeLevel,[level], parameter
  2. Parse Well-known-Text format (WKT) using a regular expression.
  3. Take the coordinates and convert to Polygon

Now depending on your situation, on a phone you may prefer to offer offline only support - because you know the maps are available directly from the device, so if you know for sure which regions you require it would make sense to pre-load the shapes based on a KML or GeoJSON file. If you don't know beforehand, your app relies on http anyway (or the potential set of locations is arbitrarily large) you may as well just http use REST geocoding for the regions you need.

By the way, one advantage of the online solution - because the Bing and Nokia Maps both use the same dataset as HERE, you can be certain that any shapes you download will match exactly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top