[postgis-devel] WKTRaster Scale and Skew

David Zwarg dzwarg+postgis at azavea.com
Fri Sep 10 07:14:12 PDT 2010


Greetings PostGIS devs,

I'm looking at a couple tickets that I assigned myself from way back when to
actually compute the rotation of a raster based on the scale and skew.

I'm finding some interesting behavior, and I want to know how to proceed:

The 'scale' and 'skew' parameters from the georeference matrix are being
handled in a strange way.  When I say strange, I mean:

   - The Y scale defaults to 1, when it should default to -1.
   - The Y skew values should be negative in our tests, but they are always
   positive.
   - The scale and skew should both be used to compute the pixel width &
   height, but currently the pixel width & height are really just synonyms for
   scale X and scale Y, respectively.
   - The values returned from rt_raster_get_pixel_width &
   rt_raster_get_pixel_height tend to be positive in tests, but if we use a
   real raster with real georeference, rt_raster_get_pixel_height will be
   negative (since the Y scale is negative in world files).
   - Our tests default the raster upper left to 0,0, but then assert
   coordinate positions based on positive skew and scale values, which really
   imply a vertical flipping of the raster -- if that is what is being tested,
   it's not called out, and I think it's a result of the +/- confusion of scale
   and skew.

In light of these items, and the ramifications they carry through the core
api tests, may I propose:

   - Width is computed based on scale & skew?
   - We don't call it scaleX and scaleY, but cell_width_x and cell_height_y
   - We don't call it skewX and skewY, but cell_width_y and cell_height_x
   - We separate the accessors for the pixel width and the georeference
   component that is now used as the width.
   - Tests assume the upper left coordinate is SMALLER in the X and GREATER
   in the Y for all other coordinates in the raster -- this would require
   adjusting our tests to handle the coordinate space uniformly.

Thoughts? I hope the FOSS4G code sprint is awesome. Wish I could be there.
Zwarg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20100910/47bf4133/attachment.html>


More information about the postgis-devel mailing list