In sharpmap , is it possible to load a default wms like a tiled map service?

I was able to use a WMS but currently it loads the map as a single image.

I desire a behavior like OpenLayers 3.


My attempt with BruTile:

      const String url = @"http://ows.terrestris.de/osm/service?dummy=dummy"; //dummy is needed because BruTile appends every parameter with ampersand

        BruTile.TileSchema schema = new BruTile.TileSchema();
        schema.Srs = "EPSG:25832";
        schema.Format = "image/png"; 
        schema.Axis = BruTile.AxisDirection.Normal;
        schema.Name = "UTM32";
        schema.Height = 256;
        schema.Width = 256;
        schema.OriginX = 271930.43;
        schema.OriginY = 5209532.85;
        schema.Extent = new BruTile.Extent(271930.43,5209532.85, 956095.08,6111268.07);

     Dictionary<String, String> parameters = new Dictionary<String, String>();
        parameters.Add("STYLES", String.Empty);

        var request = new BruTile.Web.WmscRequest(new Uri(url), schema, new List<String> { "OSM-WMS" }, new List<String>(), parameters, "1.1.1");
        var provider = new BruTile.Web.WebTileProvider(request);
        var tileSrc = new BruTile.TileSource(provider , schema);

var layer1 = new SharpMap.Layers.TileLayer(tileSrc, "OSM"); layer1.SRID = 25832;

That is what I have tried so far, but it does not work. Sharpmap shows nothing, not even an exception.

var ti = new BruTile.TileInfo();
ti.Extent = new BruTile.Extent(271930.43, 5209532.85, 956095.08, 6111268.07);
var uri = request.GetUri(ti).ToString();

This gives me a valid wms request, but I get a 407 Proxy Exception when I try the following.

 var ti = new BruTile.TileInfo();
 ti.Extent = new BruTile.Extent(271930.43, 5209532.85, 956095.08, 6111268.07);
 var tile = provider.GetTile(ti);

In Shapmap it is possible to configure a Proxy for SharpMap.Layers.WmsLayer but not for SharpMap.Layers.TileLayer. Is there another way to set up a proxy?


Not sure what you mean, either an ordinary tile layer (1) or a WMS accessed through a tile protocol (2). In both cases you could use BruTile.

1) SharpMap uses BruTile for its tile layers. You could add OpenStreetMap like this: mapBox1.Map.BackgroundLayer.Add( new SharpMap.Layers.TileAsyncLayer(BruTile.Web.OsmTileSource(), "OSM"));

Which I copied from this SharpMap Sample

2) In case you want to access a WMS in a tiled way then BruTile's WmscRequest can be used. It can access a WMS-C tile sources but also an ordinary WMS. The WMS-C requests are OGC compliant WMS requests constrained to the tile schema. There is a sample here in the BruTile repo

  • what I meant was not using tiles but splitting a single wms request into several partial requests. I think it becomes visible in this example link – smartwepa Mar 10 '16 at 15:04
  • So that is the second option. Take a look at this sample: github.com/BruTile/BruTile/blob/master/Samples/…. In what projection is your map? – pauldendulk Mar 11 '16 at 8:39
  • The projection of my map is EPSG:25832 (UTM Zone 32). I think I need my own TileSchema object. I have added my attempts to the original post. It seems like they are a few differences between the newest BruTile version and the one used by sharpmap. – smartwepa Mar 14 '16 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.