Opened 18 years ago

Closed 17 years ago

Last modified 17 years ago

#1944 closed defect (fixed)

Raster Reprojection Sometimes Very Slow

Reported by: warmerdam Owned by: warmerdam
Priority: high Milestone:
Component: GDAL Support Version: 5.0
Severity: normal Keywords:
Cc: rouault, dmorissette

Description (last modified by warmerdam)

The attached mapfile and data file with the command:

  shp2img -m rd.map -o out.png

takes far longer than it should. 

(as reported by Jan Hartmann)

Attachments (2)

rd.map (295 bytes ) - added by fwarmerdam 18 years ago.
test map
mercator.png (185.5 KB ) - added by fwarmerdam 18 years ago.
input raster file for use with test map

Download all attachments as: .zip

Change History (7)

by fwarmerdam, 18 years ago

Attachment: rd.map added

test map

by fwarmerdam, 18 years ago

Attachment: mercator.png added

input raster file for use with test map

comment:1 by fwarmerdam, 18 years ago

Status: newassigned
The problem turns out to be a logic error in the "approximate transformer"
in mapresample.c.  The problem is that if the first linear approximation
is not within the error threshold, then the logic would revert to exact
reprojection all along the line instead of using the approximate transformer
along halves of the line. 

The problem has presumably existed as long as mapserver has supported 
raster reprojection.

The patch looks like:
*** mapresample.c.~1.67.~	2006-03-15 15:31:18.000000000 -0500
--- mapresample.c	2006-10-20 14:51:55.447937048 -0400
***************
*** 1162,1169 ****
      if( dfError > psATInfo->dfMaxError )
      {
          bSuccess = 
!             psATInfo->pfnBaseTransformer( psATInfo->pBaseCBData, nMiddle, 
!                                           x, y, panSuccess );
              
          if( !bSuccess )
          {
--- 1162,1168 ----
      if( dfError > psATInfo->dfMaxError )
      {
          bSuccess = 
!             msApproxTransformer( psATInfo, nMiddle, x, y, panSuccess );
              
          if( !bSuccess )
          {
***************
*** 1173,1182 ****
          }
  
          bSuccess = 
!             psATInfo->pfnBaseTransformer( psATInfo->pBaseCBData, 
!                                           nPoints - nMiddle, 
!                                           x+nMiddle, y+nMiddle, 
!                                           panSuccess+nMiddle );
  
          if( !bSuccess )
          {
--- 1172,1179 ----
          }
  
          bSuccess = 
!             msApproxTransformer( psATInfo, nPoints - nMiddle, 
!                                  x+nMiddle, y+nMiddle, panSuccess+nMiddle );
  
          if( !bSuccess )
          {

I will apply it in 4.10 branch as well as cvs head.

comment:2 by fwarmerdam, 18 years ago

Resolution: fixed
Status: assignedclosed
Patch now applied in 4.10 branch and cvs head.

comment:3 by warmerdam, 17 years ago

Cc: rouault dmorissette added
Description: modified (diff)
Resolution: fixed
Status: closedreopened

Unfortunately, it appears that I neglected to apply the actual code fix for this in 4.10 branch, even though I did add the note about fixing it in HISTORY.TXT, and now 4.10.3 has gone out.

I will apply the fix in 4.10 branch so if there is a 4.10.4 release (a bit iffy?) it will be there.

comment:4 by warmerdam, 17 years ago

Resolution: fixed
Status: reopenedclosed

Fix applied in 4.10 branch as r6904. If there is a 4.10.4 release it should appear there.

comment:5 by warmerdam, 17 years ago

Actually, it appears 1944 was never claimed fixed in 4.10.3, it was #2180 which was actually fixed.

HISTORY.TXT fixed up.

Note: See TracTickets for help on using tickets.