[postgis-devel] [PostGIS] #1353: [raster] ST_SetRotation incorrect

PostGIS trac at osgeo.org
Wed Dec 7 11:05:50 PST 2011


#1353: [raster] ST_SetRotation incorrect
----------------------------+-----------------------------------------------
 Reporter:  bnordgren       |       Owner:  pracine      
     Type:  defect          |      Status:  new          
 Priority:  critical        |   Milestone:  PostGIS 2.0.0
Component:  postgis raster  |     Version:  trunk        
 Keywords:                  |  
----------------------------+-----------------------------------------------
 !SetRotation does not preserve the angle between the basis vectors. (The
 angle between '''i,,b,,''' and '''j,,b,,''' is different after
 St_SetRotation is called. Both axes should be rotated the same.)

 This artifact is present even in the "expected results" of the rt_rotation
 test case. Clearly, the raster id=4 had both x and y skew until
 st_setrotation(rast,0) happened. The next time we see it (the first
 id=104), both skews had been set to zero (the expectation should be that y
 skew is zero, to align the i axis with the x axis; x skew will only become
 zero if the j axis is aligned with the y axis...which it most certainly is
 not.) The net effect is that ST_SetRotation() forced the axes to be
 orthogonal when they didn't start out that way.

 The next time we see 104, ST_SetRotation(rast,pi/4) has been called on it.
 Now the i and j axes are both pointing in the same direction. Not only has
 the separation angle between the basis vectors been altered, it's one of
 the two illegal values (0 and pi). On this second trial, the axes went
 from being orthogonal to being parallel (illegal).

 I remedied this in my working git repo with an implementation of
 DevWikiRealParameters and DevWikiAffineParameters, upon which st_rotation
 and st_setrotation now depend (in that repo). We can either pluck out the
 bits and pieces relevant to this issue or wait for the gen2 iterator...or
 you can reimplement the algorithms from scratch. Plucking out bits and
 pieces may be a bit sticky, since the new code is tested with CUnit tests,
 and the postgis repo lacks this infrastructure.

 A revised "expected results" will be attached to this ticket. I checked
 this by hand with a calculator.

 The commit which fixes this in my repo is:
 https://github.com/bnordgren/postgis/commit/06f9e65537e385f2adcb1b9ae166f50f5c7ad986

 To browse source:
 https://github.com/bnordgren/postgis/tree/ri-gen2-svn

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1353>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list