This project has moved. For the latest updates, please go here.

How to add open street maps/Google/Bing maps as background layer to my sharpmap map

Topics: SharpMap v0.9 / v1.x
Aug 10, 2016 at 10:08 AM
Edited Aug 10, 2016 at 10:44 AM
I'd like to add Open Street Map/ Google Maps/ Bing Maps (Any map will do) as a background layer to my Sharpmap map.

So far I've achieved this in windows forms but I need this in a web Asp .Net, C# web site.

I found a direction to achieve this here

How ever I'm experiencing error stating that
The best overloaded method match for 'SharpMap.Layers.TileLayer.TileLayer(BruTile.ITileSource, string)' has some invalid arguments
Argument 1: cannot convert from 'BruTile.Web.BingTileSource' to 'BruTile.ITileSource'
The code used in my aspx.cs file is as below and the error occurs in the var Layerbing line.
 var ShapeDataProvider = new SharpMap.Data.Providers.ShapeFile(@"Local shp Path");

    var layer = new VectorLayer("test");
    layer.DataSource = ShapeDataProvider;
  var layerbing = new TileLayer(new BingTileSource(BingRequest.UrlBing, "", BingMapType.Aerial), "TileLayer");
I'm using sharpmap 1.1.0 with Brutile

Any help is much appreciated. Thanks in advance. Cheers!
Aug 11, 2016 at 7:41 AM
I assume you have some assembly version mismatch.
Aug 12, 2016 at 4:30 AM

Thanks for replying, I'm using below in my project
I used nuget to add the above, If this of any help to identify my error.

Can you share me a piece of code which works in accessing OpenStreetMap as background layer?
that'll be a life-saver.

Thanks again for replying.. Cheers!
Aug 12, 2016 at 8:51 AM
Edited Aug 12, 2016 at 8:52 AM
There is absolutely nothing wrong with your code.
What kind of framework are you targeting. You should have it set to .Net40 (Client).
Maybe manually cleaning the output folder will help resolve your issue, too.
Aug 17, 2016 at 7:04 AM
Edited Aug 17, 2016 at 7:06 AM
Thanks FObermaier,
I removed all the references and added again from scratch from Nuget; now it works like a charm. Previously I was targeting .Net 4 and now I'm using .Net 4.5 with sharpmap 1.1 and BruTile 
Thanks for helping. Cheers!