Search code examples
c#uwpbing-mapsuwp-mapsvector-tiles

Vector Map Tiles on Bing Map Control


Hello I am working on a UWP map based application. I am currently using Raster Tiles data to remove the Bing Map default tiles. I Want to now shift to using Vector Tiles on the Bing map control. For Raster Tiles I know there are two ways:

  1. Set Tile data via the HTTPTileSource
  2. Set Tile data via the BitMapTileSource

I want to know how can I implement Vector Tiles on the bing map control. The Vector tiles I get are of the extention .pbf. I have to hit the URL and get the .pbf file now how do I place the tile on the map?


Solution

  • This won't be easy, but can be done. There are two key things you will need to do. The first is parse the PBF data into something you can work with. PBF is a binary file format. You can find the spec for this file format here. Here are a few open source projects that can read PBF file format:

    https://github.com/motz-art/OSM-pbf-convert

    https://github.com/bertt/mapbox-vector-tile-cs

    https://github.com/OsmSharp/VectorTileToBitmapRenderer

    Once you re able to read the vector data out of the PBF file you will then need to generate an image from the data. Once you are able to do this then you can create a CustomMapTileDataSource.

    I have a sample of how to create a CustomMapTileDataSource here: https://code.msdn.microsoft.com/Adding-Opacity-and-WMS-cf6773f1/sourcecode?fileId=124374&pathId=1999022414