This project has moved and is read-only. For the latest updates, please go here.

TileLayer - expose TileSource, Request and Schema

Apr 25, 2010 at 10:36 PM


It would be nice to expose as read only properties the following on the TileLayer class:

  • TileSource
  • Request
  • Schema

This would allow us to retrieve information about the layer once in memory.



Apr 26, 2010 at 8:58 PM

hi Scott,

In general my strategy is to expose little initially and add more as proves useful. Can you tell me more on how you use the information?

There is always a workaround for TileSource and Schema since you create the TileSource yourself and this exposes the Schema.

var source = new OsmTileSource();
var schema = source.Schema;
TileLayer tileLayer = new TileLayer(source, "OSM");

Exposing the request is not so obvious since the TileSource can be of any kind, it doesn't have to be a web request. It can, for instance, implement a SharpMapProvider.


Apr 28, 2010 at 12:23 AM

Hi Paul,

Firstly I think TileLayer is a good addition to SharpMap, thanks for the effort.

I agree with your approach of only exposing what is required. I also expect that if you did expose any of the items that I suggest that they would be read only.

There are a number of use cases but the main reason for my request is to expose the layer source. I like to provide meta data about the layers to end users and the source is a critical one. I can get the source from most other layer/provider types (ShapeFile, OleDB, ECW, MsSql etc) and would like to be able to do the same for TileLayers. For example, is it a Bing or OSM layer? What URL are we using? These are fundamental values that should be exposed to the end user so they can understand the data they are using.

Yes we could create other variables to store/expose the properties used to create the TileLayer but I think that is a bit of a kludge.

In terms of the TileSource, can we not check the type of the TileSource and apply logic accordingly. I am not expecting you to expose values for every type of TileSource, perhaps just expose it as ITileSource?




Apr 30, 2010 at 2:55 PM
hi Scott, okay, it should at least be possible to request such general info. So now you show the user the type of VectorLayer already? How do you do that now for those? Paul
Apr 30, 2010 at 9:52 PM

Thanks Paul, that would be great.

For a VectorLayer/LabelLayer I check the Provider type and then display the source based on the Provider. For example, for a ShapeFile and Ogr provider I display the Provider.Filename. For a SQLServer2008 provider I display parts of the Provider.ConnectionString and so on.