MapServer / MapServer-import

3 stars 2 forks source link

reprojection of RectObj bug #1805

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: cermak@sfos.uaf.edu Date: 2006/06/22 - 02:49

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
tbonfort commented 12 years ago

Author: sdlime Date: 2006/07/12 - 08:44

This is more likely a core library problem than MapScript itself. CC'ing Frank
our proj.4 guru.

Steve
tbonfort commented 12 years ago

Author: fwarmerdam Date: 2006/07/12 - 23:34

I'll take this one.  It seems I may need to do a bit of bigging to following the
details.
tbonfort commented 12 years ago

Author: fwarmerdam Date: 2006/07/13 - 17:10

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.