VariableLayer, Layers and BackgroundLayers

Topics: SharpMap v0.9 / v1.x, WinForms Controls
Feb 25, 2011 at 4:13 PM

Dear all,

I recently tested the AsyncTileLayer with the MapBox. It works great, but when I want to overlay a ShapeFile (as static layer) over an AsyncTileLayer you will run into trouble, since the AsyncTileLayer will always be rendered on the top of the shapefile layer.

So I changed the LayerCollectionType and the Map, by adding a new layer concept: BackgroundLayer. By doing this, I end up in the map class with three distingush collections: (i) background, (ii) static and (iii) variable.

For me this approach makes sense. If for instance you want to use OSM (background), a static overlay (your map data, e.g. busstops) and a variable layer (e.g. moving buses) you can easily generate animations by only refreshing the variable layer.

Questions 1:

Does it make sense to commit these update or will it generate side effects?

Question 2:

If the answer to the previous question is yes, I would like to update the WindowsSample in order to show this feature, but I have a problem with the MapImage control, where this logic has not been implemented.... MapBox, MapBox as MapImage and MapImage... which one is the most used...?



Feb 26, 2011 at 8:02 AM

Hi Frank,

I havent looked at the AsyncTileLayer but my Mapsui project was specifically aimed at async layers. The project was initially started with the intention of porting it back the SharpMap. However it has drifted too far from SharpMap to do that now, but maybe some principles can be adopted by SharpMap.

In Mapsui all layers are async layers. They all have a cache of the data that was already fetched. The renderer only uses the cache and not the original DataSource. There is a notification when new data is fetched so the MapControl knows it needs to render again and the MapControl tell the layers if they need to fetch new data.

A problem with this approach is that a WMS cannot deal with async fetching. I think I will use synchronous rendering in this case. How does the async layer work with the WMS in SharpMap?

About your question 2. I think it is good to make a choise here. Or at least to make the other deprecated so it is clear where things are heading.

With respect to the solution file that we need to maintain. I think it is better to have a single solution where everyone works with. In the past having several solutions always meant that one or the other was not building. My choise would be to go for VS2010 express edition so everyone can download it if needed without costs. There are some changes we need to make. Like not using a folder directly in the solution and using separate sln's for web and desktop development.

just some thoughts, maybe we should discuss things like this in a voice chat session.



Feb 28, 2011 at 8:29 AM
  • I do not specifically care for MapImage control. If it is consensus that MapBox is faster, better, ... then we could (as Paul pointed out) flag it as obsolete.
    Please go ahead an post your enhancements.
  • Frank, I think the v0.9.5-Deltashell branch has lots of useful code for your purpose, you should definately take a look at it.
    In this branch, every layer has its own Bitmap/Image. That is an approach, that has to be considered as well.
  • I further agree with Paul, that we should bundle our efforts and not diverse any further. An IRC would be a good idea, though I'm very busy atm.

Cheers FObermaier