ThinkGeo.com    |     Documentation    |     Premium Support

How to use MapBox as BaseMap in a wpf application?

Hi,
		
We would like to add a layer with mapbox raster in our wpf application.
For Google or Bing layers, there are the layers GoogleMapsLayer and BingMapLayers. (layers represents
an object that encapsulates a Google Map layer or Bing Map Layer).
But for mapbox, the layer extension does not exist.
		
How to add a layer with the mapbox baseMap in a wpf application? Or how to call the Api MapBox ?
		
Thanks a lot for your help.
		
Regards.
		
		
Steph.

Hi Steph.

Our WPF edition don’t have a overlay for MapBox, but you can implement that by your custom code.

The url for MapBox should looks like: http://api.tiles.mapbox.com/v4/“mapid”/“z”/“x”/“y”.png?access_token=“your access token”

You can just implement a custom class which is inherited from our TileOverlay class, then override the GetTileCore and DrawTileCore function to implement your logic, then it should works.

Any question please let us know.

Regards,

Ethan

Hi Ethan,

Thank you for your reply.
I still have some questions.
When using BingMapsOverlay in a application for example, I imagine that this overlay encapsulates a layer of BingMapLayer.
It is not better to create a MapBoxLayer that inherits from layer …?
And then use this layer and add it in a classic overlay?

If we use the following API:
https://api.mapbox.com/v4/mapbox.satellite//{zoom}/{x}/{y}{@2x}.{format}?access_token=MyToken

How to signify the zoom level mapping between Map thinkgeo and the return of the image api? {zoom}
Same for to properly position the returned images in the map ? {y} {y}

Thank you very much for your help.

Regards.

Steph.

Hi Steph,

Because for XXXMapsOverlay and XXXMapsLayer, we implement them follow different way in different product. In some edition, the XXXMapsOverlay is a wrapper of XXXMapsLayer, but in some edition, they are totally different to require different server library. We keep them in our products to make user feel better when switch between different versions, and most of the code can be directly used without modify.

You can add the XXXMapsLayer into classic overlay, it should works.

If you want to implement a custom layer for example the mapbox, to make it works better, you should want to build a custom zoomLevelSet to make the tile image match without stretch. You can see we have the custom zoomlevel for Bing and Google. Generally you don’t need think about it and just choose the default zoomlevel set, it should works.

Wish that’s helpful.

Regards,

Ethan