Brutile-Sharpmap and WMS Tile prefetching

Dec 4, 2009 at 11:49 AM

Hi Paul,

I am evaluating Brutile for using it in a project and I have some questions:

1. Does the FileCache allows to use brutile in "offline" mode? In mean, my system is supposed to be used in the lab to configure a set of locations (no problem here because I can connect to a WMS or Google Maps), but later I will bring the computer to the field and it will be very interesting to be able to show the prefetched tiles with no need of connection to the WMS.

2. It is possible to use several layers at the same time? In our current application, we use Sharpmap to combine a WMS raster layer with a on-the-fly generated vectorial layer. It is possible to do this with brutile?

    Juan

Dec 4, 2009 at 2:52 PM

Hey Juan,

1. Yes, it can store the tiles locally. You can store them on the fly from a web request if you use an extra FileCache parameter in the constructor of WebTileProvider, or you could copy a tile directory to your device and use the FileTileProvider.  There is a sample of it in BruTileWpf. It seems you need the second one. 

2. Drawing multiple layers over each other is only possible if you use the SharpMapTileProvider. There is a sample of it in the BruTileWpf. For you it is convenient because you already work with SharpMap and you can contruct the SharpMap Map object in the same way. For compact framework you need a port of SharpMap. Do you have one? Do you use SharpMap V1 of V2? How do you currently integrate tiles into your SharpMap client, with TiledWmsLayer? This week I worked on replacing the TileWmsLayer with a BruTileLayer (so BruTile in SharpMap another way of integrating the two), it might be needed for your project.

bye,

Paul.

Dec 4, 2009 at 3:27 PM

Hi again Paul,

First of all, thanks for your fast response :)

Seems that your two options will be fine for our "offline" mode needs. Regarding the multiple layers issue, right now, we are using a TiledWmsLayer for getting the base map from a local WMS server, and we add several VectorialLayers for adding the dynamic information. We are currently using Sharpmap V1 and we are not using compact framework because we will bring an standard laptop to the field. Sharpmap seems ok for most of our needs but the map interaction is a little bit slow and we miss the possibility of getting tiles from world-available data as Google Maps or OSM. Here is where BruTile appears. 

My doubt is: if I use a SharpMapTileProvider all the tiles generated by Sharpmap will be cached in memory (and also in disk if we use a FileCache)? This will be a problem for us because the vectorial layers are being modified almost in real time. 

I understand that the new BruTileLayer will use the WebTileProvider and FileTileProvider for providing tiles to Sharpmap and this will be great for our project because we can use a local WMS or Google Eart/Bing/... for base map. Then, if BruTileLayer uses the caching mechanisms and we are able to disable the cache for the SharpMapProvider (for not caching the tiles generated by Sharpmap) we can use BruTile+Sharpmap for all our mapping needs.

What do you think of this configuration? 

     Juan

Dec 7, 2009 at 8:14 AM

Hi Juan,

SharpMapV1 + laptop will make it easier.

For all layers the file caching is optional, but the memory caching is not. So you can create a SharpMapTileProvider in brutile without file caching. In the SharpMapTileProvider Map object you could create BruTile WMS, and tile layers that do use FileCache. The BruTileLayer will use the BruTile core dll and will have all functionality in there.

Currently there is no way to render dynamic data. Within our company we wrote some custom rendering for points, which is quite easy to do. There will be something like that in BruTile but not soon. I am looking for a solution where I could reuse SharpMap for that too.

A possibility is to add a refresh button to clear the memory cache. It will built up within a second. But I don't know if that is fast enough for the rate of change of your dynamic data.

Paul

 

 

Dec 14, 2010 at 11:11 AM
pauldendulk wrote:

Hey Juan,

1. Yes, it can store the tiles locally. You can store them on the fly from a web request if you use an extra FileCache parameter in the constructor of WebTileProvider, or you could copy a tile directory to your device and use the FileTileProvider.  There is a sample of it in BruTileWpf. It seems you need the second one. 

2. Drawing multiple layers over each other is only possible if you use the SharpMapTileProvider. There is a sample of it in the BruTileWpf. For you it is convenient because you already work with SharpMap and you can contruct the SharpMap Map object in the same way. For compact framework you need a port of SharpMap. Do you have one? Do you use SharpMap V1 of V2? How do you currently integrate tiles into your SharpMap client, with TiledWmsLayer? This week I worked on replacing the TileWmsLayer with a BruTileLayer (so BruTile in SharpMap another way of integrating the two), it might be needed for your project.

bye,

Paul.

Nice...  but...  how can i create the "tile directory"...     in the sense....  i would like to pre-render the tiles from my basemap data...    using my style   how can i arrange this tile directory?

And how can i make it  running with the FileTileProvider?

 

Thanks

Alberto

Feb 24, 2011 at 3:53 PM

Sorry Paul, how can I find BruTileWpf sample? Looks not present in the trunk...

Feb 24, 2011 at 5:32 PM

Diego, it moved to mapsui.codeplex.com

Hth FObermaier

Feb 24, 2011 at 6:15 PM

thx, I look into it

Feb 25, 2011 at 10:57 AM

hi Diego, good to see you around again. What was the reason you were looking for the WPF sample?

Paul

Feb 25, 2011 at 11:02 AM

Hi paul ;)

I need to build a sample product for my company that can load tiles from a local resource into a desktop app, and provide simple drawing capabilities (i.e: add points to a map).

So I'm looking about how to do that stuff.

I think that the best way to do this is using SharpMap and a TileLayer with A custom implementation of ITileSource, that calls a VectorLayer and cache the results.

But in the samples I've seen that it's possible in some way to "draw" GIS geometries over mapsui, right?

anyway, amazing stuff ;)

Feb 25, 2011 at 7:15 PM
Edited Feb 26, 2011 at 7:29 AM

Yes, you  can now draw vectors directly onto the canvas, but the current implementation is slow. New features are created on every iteration. There are several options to make this faster. The fastests is probably rendering into a tile. I had this functionality in an earlier version but broke it because my renderers now only renders its cache. This is what makes Mapsui fast and response. But when rendering into a tile you want all the data for that tile. So there should be a way to use the renderer in a no-cache mode. I'm thinking about a good way to allow that.

Paul

Feb 27, 2011 at 10:40 AM

Are there some samples about drawing vectors directly on the canvas? My "editing" needs are minimal, so I don't fear about poor performances, so I would like to give a try.

Thanks for support ;)

Feb 27, 2011 at 10:42 AM
Edited Feb 27, 2011 at 10:42 AM

Another question: the sharpmap version used by Mapsui looks very different that anyone seen in the standard repository... have you used a branch or it's a brand new version that fits into Mapsui's needs?

Feb 27, 2011 at 11:00 AM

With 'drawing' I didnt mean edit functionality. Just rendering a polygon onto a canvas without using tiling. Editing is something you have to add yourself. You could use MemoryProvider and edit it's Features. 

You can see rendering of shapefile vectors in the Mapsui.WinForms sample and in the 'shapefile' sample of Mapsui.Wpf.

Paul

Feb 27, 2011 at 11:22 AM

The Mapsui version is port of SharpMap. It was orginally a branch in SharpMap (SharpMapSilverlight) but svn hassles forced me to move it here. 

I changed it quite a lot. I use async data fetching for all layers and I replaced the System.Data.DataTable with a Features collection because there is no DataTable in Silverlight (which is my main focus).

I ported a number of the DataProviders too but I now plan to create an adapter (which could be quite simple) that accesses the orginal SharpMap data providers, to reduce duplication. The adapter implements Mapsui's IProvider and takes a SharpMap IProvider as constructor argument and translates internally (which I am already doing within the DataProviders). This solution will only work for desktop and not for Silverlight, since I cannot use the SharpMap desktop dlls from the Silverlight project. So I still need Mapsui versions for some of the providers, but only for web service access. Most database and file dataproviders can be deleted from Mapsui.

Although file access is possible throught a file dialog in Silverlight I think I will ignore this for now. I can see it's use in scenarios where you want to upload some local data to a service. So the user can browse to a shapefile and use Mapsui to upload it.

Paul

Feb 27, 2011 at 11:57 AM
pauldendulk wrote:

With 'drawing' I didnt mean edit functionality. Just rendering a polygon onto a canvas without using tiling. Editing is something you have to add yourself.

sorry, this is exactly what I need, using the word "editing" is my mistake.

I look to the code. Thanks again.