GDAL layer bug

Topics: General Topics
Sep 6, 2006 at 4:30 PM
Hi everyone,
I´m trying to use GdalRasterLayer, when I do ZoomToExtents it fit the raster image into my cliping rectangle, so far so good, and when I do translation using map.ZoomInTo(Point) it always fit the border of raster image with the border of my Sharpmap Image and sometimes it throws the folowing exception:

Error while reading raster file
Access window out of range in RasterIO(). Requested
(0,2224) of size 4286x64 on raster of 4320x2160.

Anyone know how can I fix this ??

Thanks in advance

Operator
Developer
Sep 6, 2006 at 10:54 PM
Christian: Could this be resolved by added a check for whether x1width and y1height is larger than 0 ?

Furthermore is seems strange that you initialize an image of the full extent of the requested image, instead of just an image of the size of the portion of the gdal-image to be rendered. Ex.: If you pan so that you have the corner of the gdal-image in the center view, only 1/4 of the gdal-image should actually be read to a to memory and drawn on the output map.

Another optimization could be to render the image from gdal directly to the output image instead of using the graphics object to draw the gdal-image in the end.

Hmm this seems kinda hard to explain here, but we can also continue the discussion on chat or email.
Developer
Sep 6, 2006 at 10:59 PM
Another thing... Why is this commented out:
if (this.Envelope.Intersects(map.Envelope))

As far as I can see, this line would probably resolve the problem here (but I guess you commented it out for some reason).
Coordinator
Sep 7, 2006 at 7:38 AM
Hi SharpGis,

Thanks for you suggestions. I will have a look at it
this evening.

BR
/Christian
Oct 3, 2006 at 10:08 AM
Hi SharpGIS,

I am also struggling with the same problem discussed here. It would be great if you coucld post an example of how to use the GDAL Layer, such that while panning or zooming near the borders only the portion of the GDAL layer available is made the center of the image.

Regards,
Vijaysudh.M
Jul 30, 2007 at 3:43 PM
Hi SharpGIS,

I am also having a similar issue and frequently getting a RasterIO Acess out of bounds exception. Thanks for the suggestion of skipping the graphics object, this might solve one of my issues. However, I am a bit new to this space, so I am struggling a bit.. Any examples would be very helpful :)

Regards,
Kurt
Aug 21, 2007 at 7:56 AM

-->Hi SharpGIS,

-->I am also having a similar issue and frequently getting a RasterIO Acess out of bounds exception. Thanks for the suggestion of -->skipping the graphics object, this might solve one of my issues. However, I am a bit new to this space, so I am struggling a -->bit.. Any examples would be very helpful :)

-->Regards,
-->Kurt


for me also… I have much problem with the too large images
Aug 21, 2007 at 2:19 PM
Edited Aug 21, 2007 at 2:53 PM
Ben:

I noticed that you tried out my new GDalRasterLayer code. I did find a few bugs in it that i have fixed...however, I don't know the best way of posting fixes on this site... Please vote for my work item to make sure this code gets added to the source.

On a side note, I regulary load images over 2 gigs large, with pixel lengths and widths over 10000.

GDalRasterLayer code can be found here: http://www.codeplex.com/SharpMap/WorkItem/View.aspx?WorkItemId=12134

Dan
Coordinator
Aug 22, 2007 at 2:38 AM
Edited Aug 22, 2007 at 2:40 AM
Hi Dan -

This looks like a great improvement. I'm glad its already getting some use!

I'm going to try to include the GDALRasterLayer improvements you've contributed. Is the one in patch 193 the same as in GDALRasterLayer renders incorrectly when extents are smaller than map extents?

Also, would you be able to include some unit tests to help accelerate the inclusion?

Thanks!
Aug 22, 2007 at 9:26 PM


codekaizen wrote:
Hi Dan -

This looks like a great improvement. I'm glad its already getting some use!

I'm going to try to include the GDALRasterLayer improvements you've contributed. Is the one in patch 193 the same as in GDALRasterLayer renders incorrectly when extents are smaller than map extents?

Also, would you be able to include some unit tests to help accelerate the inclusion?

Thanks!


The code in patch 193 uses most of the same code in that work item, but the patch code contains much more functionality.

What would I need to do for the unit tests?

Dan
Coordinator
Aug 22, 2007 at 10:43 PM


What would I need to do for the unit tests?


That is a very good question.

I need to create a check list for contribs, and I'll put in an example of what would make a good unit test for a SharpMap contrib, since some of the dependencies can get tricky to stub or mock.