0

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?

rbrundritt
  • 16,570
  • 2
  • 21
  • 46
iam.Carrot
  • 4,976
  • 2
  • 24
  • 71

2 Answers2

3

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

rbrundritt
  • 16,570
  • 2
  • 21
  • 46
  • Thank you for the answer, I just have one question, you've added links about OSM pbf convert and OsmSharp(which is also a nugget) I won't be using the OSM vector pbf files. I would be using some other custom ones. So the first two links you've provided would they apply to not OSM pbf files too? – iam.Carrot Jan 11 '17 at 03:43
  • If your custom data is in the PBF format, then it should work fine. OSM should be using a standard PBF format. – rbrundritt Jan 11 '17 at 18:14
  • I checked out those links. Turns out mapbox-Vector-Tile-CS is not supported in a UWP project, VectorTileToBitmaprender is using WPF platfrom so the class it's using are not available and the OSM-pbf-convert doesn't really explain how to use it. Can you please provide me with some insights. – iam.Carrot Jan 18 '17 at 14:16
  • FYI: mapbox-vector-tile-cs now works on UWP (NuGet https://www.nuget.org/packages/mapbox-vector-tile/3.1.3) – bertt Jan 24 '17 at 20:33
  • Hi @bertt, I just used your library to implement a complete vector tile rendering engine in C#. It doesn't support UWP yet, but the results are promising. Check it out: https://github.com/AliFlux/VectorTileRenderer Thanks for the lib. – Ali Ashraf Apr 14 '18 at 16:00
2

I faced the same issue. So I ended up writing my very own vector map rendering engine in C#. It supports the mapbox vector tile specification and styles.

The project repository contains demos for Mapsui and Gmap.Net integration, check it out and let me know what you think about it.

NY comparison

You can find it here:

https://github.com/AliFlux/VectorTileRenderer

Ali Ashraf
  • 759
  • 1
  • 8
  • 17