WMS/TMS etc. support?

Dec 16, 2010 at 2:13 PM

Hi, I just want to get an idea of the development direction DotSpatial is going in. Is support for WMS / TMS being considered for the future?



Dec 16, 2010 at 3:22 PM

I think some folks just added something called a BruTileLayer.  I think this is a form of WMS, but I haven't tried it so I'm not sure.  I'm not sure what TMS is, maybe "Tile Map Service"? so ... not yet.  Maybe the BruTileLayer is in the domain of TMS, but if not, then it may not be supported yet, but I think there is a lot of interest and so it will probably be added and up and running before I get back from my holiday break.



Dec 16, 2010 at 9:53 PM
Edited Dec 17, 2010 at 7:09 AM

BruTileLayer is a draft IMapLayer implementation that uses BruTile for getting, storing/caching tiles for use in a DotSpatial MapFrame.

BruTile itself  is a "C# library for GIS tile services such as those of Bing maps and OpenStreetMap".

Supported tile services are:

  • TMS
    • OpenStreetMap
    • Geodan's geoserver.nl
    • Many others
  • WMS-C (and consequently an ordinary WMS)
  • Bing Maps
  • ArcGis Tile Server
  • Simple generic tile requests.

If you're interested to test you can get the code and some basic instructions from here.

Hth FObermaier

Dec 17, 2010 at 12:07 PM

Ok, thanks for the info, looks very interesting.

Apr 2, 2011 at 4:56 PM

Any chance anyone got projections to work with this sample ?

Apr 4, 2011 at 8:09 PM

Kurt Wolfe turned the BruTile example into a DotSpatial plugin. His work is in the MapWindow SVN repository:


The two folders BruTile and BruTileSrc look interesting for that.

There is also a similar DotSpatial plugin in the same folder called FetchBasemap which was built for HydroDesktop.

Finally, mwTiles is a port of a similar MW4 plugin. I am not sure whether this version works, but it is not as current as the BruTile and FetchBasemap plugins.

May 28, 2011 at 2:02 PM

Which is the projection used by brutile ?

I just want to zoom to a specific extent. is it possible ?

May 30, 2011 at 11:26 AM

The SRS is dependant on the TileProvider. For OSM, BING, GOOGLE, et al. it is almost certainly EPSG:3875 (WebMercator).

If you add a BruTileLayer, it automatically pulls all tiles valid for the viewport.

BruTile does not reproject the tiles, so, if you want to use it with any of the above tile providers, you are stuck with EPSG:3875.

Cheers FObermaier

May 31, 2011 at 2:19 PM

nice ...

i just did this using the following code:

		Dim wgs84 As ProjectionInfo = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984
                MapReal.Projection = wgs84
                Dim sphericalMercator As ProjectionInfo
                sphericalMercator = New ProjectionInfo("+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ")
                Dim extents As Extent = mapFrame.ViewExtents
                Dim minXY() As Double = New Double() {extents.MinX, extents.MinY}
                Dim z() As Double = New Double() {0}
                Reproject.ReprojectPoints(minXY, z, wgs84, sphericalMercator, 0, 1)
                Dim maxXY() As Double = New Double() {extents.MaxX, extents.MaxY}
                Reproject.ReprojectPoints(maxXY, z, wgs84, sphericalMercator, 0, 1)
                'MapReal.ViewExtents = New Extent(minXY(0), minXY(1), maxXY(0), maxXY(1))
                Dim NEWEXT As Extent = New Extent(minXY(0), minXY(1), maxXY(0), maxXY(1))
                Dim centerXY() As Double = New Double() {mapFrame.ViewExtents.Center.X, mapFrame.ViewExtents.Center.Y}
                MapReal.Extent.SetCenter(New Coordinate(centerXY(0), centerXY(1)))

Jun 13, 2011 at 12:33 AM

Hi Felix,

I Downloaded your DotSpatial.Controls.BruTileLayer.zip and add the DotSpatial.Controls.BruTileLayer.dll to the resources of my dotspatial VB.net 2010 project.

Then I added this

Private Sub RibbonButton24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RibbonButton24.Click
    End Sub

I get this error:

Die Datei oder Assembly "DotSpatial.Controls, Version=, Culture=neutral, PublicKeyToken=4d9e49339a7d240c" oder eine Abhängigkeit davon wurde nicht gefunden. Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein. (Ausnahme von HRESULT: 0x80131040)

It seems it want's an other version of DotSpatial.Controls, I am using Version=1.0.2011.4 (DotSpatial_x86_fw40_20110422)

Sorry it's a German VS 2010

Thank you


Jun 13, 2011 at 2:08 PM

Hallo Thomas, deutsch ist für mich kein Problem.

Der Patch ist schon älter, vielleicht hilft es, den Verweis auf DotSpatial.Controls neu anzulegen, oder aber die Projektausgabe der gesamten "Solution" zu bereinigen und neu zu übersetzen.

Hth FObermaier

Jun 14, 2011 at 12:04 PM

Hallo Felix,

So hat es geklappt, die Verweise gelöscht, neu hinzugefügt,, neu übersetzt, bingo....

Vielen Dank


Jun 27, 2011 at 11:47 AM

i want to show a raster layer on top of a brutile layer.

Is it my idea or every other layer on top of the blutile layer is not shown/drawn?

Any ideas why is this happening and how to fix this ?

Jun 30, 2011 at 1:34 PM

I'm starting to look at using BruTileLayer.  I downloaded the zip file.  The contents are dated 12/15/2010.  Is this the most recent version?  Also, would you advise downloading the most recent released BruTile from codeplex and using it with the BruTileLayer?  Will it be compatible?



Jul 1, 2011 at 10:02 AM

Hello Kyle,

I just checked, the recently released BruTile version works, but for some reason is -at least on my machine- dreadfully slow.

You might want to stay with the version provided until that issue is resolved.

There are some enhancements to the code:

  • bug fixes
  • BruTileLayerPlugin

I'll raise an issue providing the code.

Cheers FObermaier

Jul 1, 2011 at 12:47 PM

Thanks FObermaier, for raising the issue. I'm having good success with this so far. The canned sources like OSM, Bing, Google are great.  Can you point me to somewhere that has examples or documentation using BruTile with WMS?

Thanks. Kyle

Jul 1, 2011 at 1:12 PM

Have a look at http://arcbrutile.codeplex.com.

Maybe we can start a DotSpatial plugin like that?

Hth FObermaier

Jul 4, 2011 at 7:55 AM

Does anyone if it is possible to draw other layers on top of a blutile layer?

i don't understand why every other layer is not shown :(

Jul 4, 2011 at 11:27 AM

For me it works.

You need to set the projection of the vector layer to WebMercator.

Use Bing Map, OSM is very slow using the last DotSpatial dlls. ;-)

Jul 4, 2011 at 7:55 PM

@ambiente: I just figured out that you need to uncheck the checkbox "automatically search for settings" in the Internet Explorer settings, tab Connection, button LAN Connection.

Jul 5, 2011 at 1:00 PM


automatically search for settings is unchecked at my PC.

After I compiled with DotSpatial 5-23-2011 your BruTileLayer.dll 


works fine but


Load the world map but after this, any zoom freeze the application.

Jul 5, 2011 at 1:21 PM

try latest brutile release (v0.5.1)

Jul 6, 2011 at 1:52 PM

Now I tried with the brutile release (v0.5.1).

The OSM now loads after zoom with a lot of timeout and blank tiles but better than freeze the app.

Strange is changing to the  Bing Street option the load is fast and without any timeout.

During the zoom my Direct Window show this exceptions.

Eine Ausnahme (erste Chance) des Typs "BruTile.Web.WebResponseFormatException" ist in BruTile.dll aufgetreten.
Eine Ausnahme (erste Chance) des Typs "System.Net.WebException" ist in System.dll aufgetreten.

Any idea?

Jul 6, 2011 at 3:05 PM

If you have set a proxy, try to disabe it.

Raise an issue at brutile.codeplex.com

Jul 6, 2011 at 9:22 PM

The proxy settings have cause problems before, I never got around to testing it properly. You could try to remove the proxy code and rebuild. 

It is in BruTile\Web\RequestHelper.cs. Remove these lines:

#if !PocketPC
            IWebProxy proxy = WebRequest.GetSystemWebProxy();
            proxy.Credentials = CredentialCache.DefaultCredentials;
            webRequest.Proxy = proxy;
            webRequest.PreAuthenticate = true;


Jul 6, 2011 at 9:51 PM
Edited Jul 6, 2011 at 9:53 PM

oh, FObermaier and Moses have come up with a solution:

In Internet Settings | Connection | LAN Connection the checkbox called sth like "automatically search for settings" needs to be unchecked 


Here is a stackoverflow thread about the issue : http://stackoverflow.com/questions/2519655/httpwebrequest-is-extremely-slow

Perhaps it would improve if I don't recreate the HttpWebRequest object on every request.


Aug 21, 2011 at 1:12 PM

I was connected with a slow Internet link, now with a DSL connection the BruTile layer support with OSM works perfect for me.

After adding the BruTile layer I need to use webmercator projection for all layers to show the shape file layers on top of the BruTile layer.

Using the print command of Dotspatial adding the map to the layout page only the shape file layers are shown but not the BruTile Layer.

How I can print out all together? Export to bitmap works with all included layers.

Aug 23, 2011 at 1:59 PM

I am not positive about this, but when i was looking through the BruTileLayer code I recall that it was always using the extents of the MapFrame instead of looking at the information passed into DrawRegions or something like that, and I remember thinking, this may not work for printing.  Having said, that, I will probably be looking at some printing issues in the next week or two.  If I find anythng relevant, I will post what I find here. Kyle

Jul 6, 2012 at 3:41 PM


Could you give an example code. I am stuck on trying to get shp data displayed on a brutile based map.

My current (not working) solution is:

IFeatureSet f = FeatureSet.Open("test.shp");

Maybe someone has a hint? 

Jul 7, 2012 at 9:05 AM

In my project I am using it this way:


Dim _btLayer As BruTileLayer
' Add OSM Layer as base layer
            _btLayer = BruTileLayer.CreateOsmLayer()
            Map1.Projection = KnownCoordinateSystems.Projected.World.WebMercator


 'AddLayer() method is used to add a shapefile in to mapcontrol

Adding the shp layer dotspatial ask you to reproject the shp layer if it is not 


Is there no projection file .proj with your shp file Use Latitude and Longitude (WGS1984) from the Invalid or Missing Projection Dialog box.


After this you will get a message

Projection Mismatch
Reproject map layer to match the map coordinate system? This will not affect the source file.

Click Yes.


Jul 10, 2012 at 12:46 PM

Thank you very much for the answer.

It points me in the right direction. One question remains for me. Is it possible to get that behaviour without having to use dialogs?  I would like to reproject the shp file to KnownCoordinateSystems.Projected.World.WebMercator to match the brutile, but set this value in code.

When I set the value to a shape layer before adding it to the map, I get not dialog and apparently the chosen ProjectionInfo is valid, but nevertheless the shapes are on wrong locations,  near the coordinate pair <0,0>, as if the coordinates were not interpreted as degrees but as meter (like utm ...).

Thanks and hoping for another hint :-)

Jul 10, 2012 at 6:43 PM

Here my hint's

Add this before load the shp file

Map1.ProjectionModeReproject = ActionMode.Always


Your .prj file needs to be like this:




Jun 5, 2013 at 4:02 AM
how do i can rebuild BruTileLayer to use in my own mapwindow 4 application? please help me!
sorry, my english is not well.
Oct 22, 2014 at 10:01 AM
thongnt wrote:
how do i can rebuild BruTileLayer to use in my own mapwindow 4 application? please help me!
sorry, my english is not well.
Call me: 0976502092