Opened 18 years ago

Closed 18 years ago

#1805 closed defect (worksforme)

reprojection of RectObj bug

Reported by: cermak@… Owned by: warmerdam
Priority: high Milestone:
Component: MapScript Version: 4.6
Severity: normal Keywords:
Cc:

Description

There seems to be a reprojection bug for rectangular objects.  This seems to
impact mapscript PHP and Python.  Looking over bugzilla there seems to be
various projection issues, this may be a duplicate bug.  It seems to impact all
projections.   The first test amazingly works but PHP and python result in
different values for its forward transformation.

Single points seem to work fine.  A condition that works is when:
minx = maxx and miny = maxy (a point).

Sample code is given in this bash script: http://ak.aoos.org/data/tmp/test_proj.txt

Output: http://ak.aoos.org/data/tmp/test_proj_output.txt

The PHP component:
  http://ak.aoos.org/data/tmp/test_proj.php.txt

Please feel free to contact me offline for questions or more
information: cermak *AT* sfos.uaf.edu

Change History (3)

comment:1 by sdlime, 18 years ago

Cc: warmerdam@… added
This is more likely a core library problem than MapScript itself. CC'ing Frank
our proj.4 guru.

Steve

comment:2 by fwarmerdam, 18 years ago

Cc: steve.lime@… added; warmerdam@… removed
Owner: changed from sdlime to fwarmerdam
I'll take this one.  It seems I may need to do a bit of bigging to following the
details.

comment:3 by fwarmerdam, 18 years ago

Resolution: worksforme
Status: newclosed
Rob,

First, projecting a rectangle forward and then back is not expected to 
result in the original.  Because a rectangle that is reprojected is no longer
actually square in the new projection, we try and compute an approximate 
bounding box for the transformed box.  This is somewhat bigger.  The same
thing happens when projecting back.   So that aspect is not surprising and
not considered an error.

I don't know why you are seeing different results from PHP and Python.  I 
*suspect* you are picking up an older version of mapscript from one or the
other, possibly resulting in using different approximation logic. 

I ran the test script and got matching results (with mapserver 4.9 dev). 

warmerda@gdal2200[164]% test_proj.sh 

 <id>STP</id>
 <name>Pribilof Islands</name>
 <extent>-1286949.88793 682395.11496 -313505.796226 1507920.00024</extent>
 <lon_lat>-175 56 -160 62</lon_lat>


Forward:
-1286949.89     870703.69
-312900.44      1350118.24

Reverse:
175dW   56dN
160dW   62dN

Quick MapServer Extents Calculation
http://zcologia.com/news/daylist_html?year=2005&month=4&day=4
-0.00   -9020047.85
0.00    9020047.85

Python mapscript tests

Test 1 : http://zcologia.com/news/daylist_html?year=2005&month=4&day=4
INPUT  : -180.0 -90.0 180.0 90.0
FORWARD: -18040095.6961 -9020047.84807 18040095.6961 9020047.84807
REVERSE: -180.0 -90.0 180.0 90.0

Test 2 : Using Pribilof Islands
INPUT  : -175.0 56.0 -160.0 62.0
FORWARD: -12223186.7344 6468757.45313 -10001177.5929 7050757.81653
REVERSE: -179.927728601 55.999590457 179.886125388 61.9995845693

Test 3 : Using Pribilof Islands (+init=epsg:102006)
INPUT  : -175.0 56.0 -160.0 62.0
FORWARD: -1286949.88793 682395.11496 -312900.441768 1507920.00024
REVERSE: -178.720996136 54.3891812472 -159.032046476 63.4056912562

Test 4 : Simple New Jersey Test [-76.1 39.0 -73.0 41.6]
INPUT  : -76.1 39.0 -73.0 41.6
FORWARD: -6532228.44758 4656172.37455 -6118145.24588 4946275.28694
REVERSE: -77.9407250906 38.9997511615 -71.2759599496 41.5997188253

PHP mapscript tests

Content-type: text/html
X-Powered-By: PHP/4.3.8


Test 1 : http://zcologia.com/news/daylist_html?year=2005&month=4&day=4
INPUT  : -180.000000 -90.000000 180.000000 90.000000
FORWARD: -18040095.696147 -9020047.848074 18040095.696147 9020047.848074
REVERSE: -180.000000 -90.000000 180.000000 90.000000

Test 2 : Using Pribilof Islands
INPUT  : -175.000000 56.000000 -160.000000 62.000000
FORWARD: -12223186.734392 6468757.453129 -10001177.592946 7050757.816533
REVERSE: -179.927729 55.999590 179.886125 61.999585

Test 3 : Using Pribilof Islands (+init=epsg:102006)
INPUT  : -175.000000 56.000000 -160.000000 62.000000
FORWARD: -1286949.887926 682395.114960 -312900.441768 1507920.000239
REVERSE: -178.720996 54.389181 -159.032046 63.405691

Test 4 : Simple New Jersey Test [-76.1 39.0 -73.0 41.6]
INPUT  : -76.100000 39.000000 -73.000000 41.600000
FORWARD: -6532228.447576 4656172.374550 -6118145.245876 4946275.286939
REVERSE: -77.940725 38.999751 -71.275960 41.599719

So far I don't see any problems here, at least in 4.9.   Reopen if you
think there is an issue that needs to be dealt with.

Note: See TracTickets for help on using tickets.