Error when render large image

Topics: CompactFramework, SharpMap Project, SharpMap v0.9 / v1.x, Web Controls, WinForms Controls
Aug 26, 2008 at 4:25 AM
Edited Aug 26, 2008 at 10:40 AM
I want to render a large image with size  20000X20000 pixel. I get an exception in function Map.GetMap() at this line : System.Drawing.Image img = new System.Drawing.Bitmap(this.Size.Width, this.Size.Height);
Are there method create a bitmap follow:
System.Drawing.Image img = new System.Drawing.Bitmap(20000, 20000); ? // error :parameter is not valid
Aug 26, 2008 at 10:44 AM
Hi trieuvy.

This is not a SharpMap Issue but an issue (very annoying one at that) with GDI+.

Aug 27, 2008 at 2:10 AM
Hi PeterSteen !
OK. There are a mistake of GDI+ but if sharpmap use it,there'll be a sharpmap's issue.
I wonder are there method to surmount it ?
If sharpmap can render image with large size. It 'll improve limits  of  present GIS software 
Aug 27, 2008 at 6:37 AM
You are outside the limits of what is practical. Even PhotoShop would have a problem working with an image that big, and probably only wavelet-compressed images would be useable (something that isn't well-suited for the vector graphics that sharpmap produces and that it's not even capable of saving it as).

Remember you are reservering 4 bytes per pixel (red, green, blue and alpha), so that's over 1525mb of memory for one object! Well beyond what .NET is capable of handling, so therefore also well beyond what SharpMap can do. I don't think putting a hard limit in SharpMap is the way to go. It will all depend on your system and application as to how much memory you can reserve.

Instead split your image up in a set of (much) smaller image tiles and place them next to each other.

I wonder what your use-case for an image that big really is? My bet is that even if SharpMap could make an image that big, you are going to hit a billion other problems afterwards.
Aug 27, 2008 at 8:39 AM
1,use GDAL to build Pyramid Tile
 2,according to the coordinate of map,use quadtree to get the map. 
Aug 27, 2008 at 10:28 AM
Hi Odegaard
I can render a lot of  small image and  put  them together . But if there are some text show in this image and lost a part in another image. Sharpmap only draw text ( label layer) of geometry  in image size( map screen).
Hi hshutao!
Can you give a example clearly? what is "quadtree" ?
Aug 27, 2008 at 12:26 PM
Hi trieuvy

Build Pyramid Tile:

the way : please see

i will also  do such work. but not this time.

sorry, bad English.

Aug 28, 2008 at 1:56 AM
Hi hshutao and everybody !
Thanks for your link.I think pyramid tile is use for 3D vector render.  I can render a lot of  small image and  put  them together by set specific tiles. But there some mistake in label layer.There are some text show in this image and lost a part in another image.
Photoshop is can create a image with  32000x32000 size. But GDI+ is only 12800x12800. I want to know  there are method to render image larger than new Bitmap contructor in GDI+ ? And we can create a image as big as possible, i don't talk to memory of computer. I assume enough  computer memory for that.
Sep 3, 2008 at 4:51 PM
Hi trieuvy, you can get around the label clipping issue by buffering the data for the label layer: perhaps this will help  hth jd