Map Refresh time

Topics: SharpMap v0.9 / v1.x
Dec 4, 2009 at 8:27 AM

Hello,

 

I wrote an application with a map displayed in a map picture box.
Map is a 38MB ecw file.

I added a layer to  this map.
I show or Hide this layer through Windows Message Check :

private void cbMessages_CheckedChanged(object sender, EventArgs e)
{
    Layer.Enabled = !Layer.Enabled;
    mapImage.Refresh();
}

 

Refresh time is about 1 second : is it normal ?

Is there a better way to refresh only the layer that is much quicker ?

 

The same way, on another layer on that same mapImage, I draw a png picture (a point) to be shown on the previous layer.
I move this point every second. In the function, I need to use mapImage.Refresh() to show the point in its new position. But it takes about one second. Furthermore, during this time, mapImage_mouseMove is locked...

Is there another way to refresh only the layer that is much quicker ?

 

Thanks for your help,

Regards,
JLC333

Coordinator
Dec 4, 2009 at 11:19 AM

Hi JLC333, Perhaps you could use some kind of caching on the ecw layer e.g cache the request's data against the extent of the request and reuse it if the extent has not changed on the next request without requerying.

You could do this either by creating a new layer type or by running two maps and merging the result into a third final image. I don't use raster data sets much and I dont know about the specifics of ecw but assuming the whole file must be read 38Mb/s seems reasonable IO depending on the disk it is being read from. If you have access to a profiler it would be interesting to see what is taking the time (maybe try DotTrace or ANTS)

The trunk sharpmap does all its rendering on the UI thread hence the 'locked' mouse move the 1.1experimental branch is async perhaps you could try and modify the trunk version using 1.1 as a reference? 

hth jd

Dec 4, 2009 at 12:29 PM

Thank you for you reply johndiss.

I forgot to say I develop a desktop application, not a wms.

I'm not sure to have understood everything about trunk release you're talking about : do you mean 1.1 release should be better ?

 

Regards,

JLC333

Coordinator
Dec 4, 2009 at 2:07 PM
Edited Dec 4, 2009 at 2:27 PM

Hi JLC333 have a go with http://sharpmap.codeplex.com/SourceControl/changeset/view/62004#1024209 it is basically a wrapper around a normal GdalRasterLayer that caches the last rendered map and resuses it if nothing has changed. I didnt mean to use the 1.1 experimental branch - (though you are more than welcome to) just that you may be able to implement your own async control using that as a reference.. hth jd

Dec 4, 2009 at 3:42 PM

Hi,

I bypassed the problem using a C# PictureBox control with a png file.
I place this object using WorldToImage function.


It works fine for the location, but I've got a pb with transparent color :
Object backcolor is set Transparent. When I draw this object on the picture box image of mapImage, transparent color is not the map but the backcolor of the parent control that map image is on...

Do I need a special setup to see map image under my Object through its transparent color ?

 

Thanks,
JLC333

 

Coordinator
Dec 4, 2009 at 3:54 PM

That is one of the WinForms gotchas ;).. you would do better drawing the png image onto the map image - there are some workarounds on the web but they're not pretty...