Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#1562 closed defect (fixed)

bad raster transform when BBOX is specified within request

Reported by: xslove@… Owned by: warmerdam
Priority: high Milestone:
Component: WMS Server Version: 4.6
Severity: normal Keywords:
Cc:

Description

I successfully configured mapserver as a WMS server. I added raster layer into 
map file. This raster has associated wld file (georeferencing transfrom 
parameters) - image is rotated and sheared. When I send request without BBOX 
parameter it is drawn ok. When BBOX parameter is specified, raster layer is 
drawn bad without rotation and shearing...

my map file:
NAME WMS-test
STATUS ON
SIZE 800 600
# EXTENT -650000 -1250000 -550000 -1100000
EXTENT -700000 -1300000 -500000 -1050000
UNITS METERS
SHAPEPATH "c:/shp"
IMAGECOLOR 255 255 255


OUTPUTFORMAT
  NAME jpeg
  DRIVER "GD/JPEG"
  MIMETYPE "image/jpeg"
  IMAGEMODE RGB
  EXTENSION "jpg"
END


WEB
  IMAGEPATH "/ms4w/tmp/ms_tmp/"
  IMAGEURL "/ms_tmp/"
  METADATA
    "wms_title"           "WMS Demo Server"
    "wms_onlineresource"  "http://127.0.0.1:8080/cgi/mapserv.exe?"
    "wms_srs"             "EPSG:4818"
  END
END


PROJECTION
  "init=epsg:4818"
END


LAYER
  NAME "rastr"
  METADATA
    "wms_title"    "rastr"
  END
  DATA "rastr.jpg"
  TYPE RASTER
  # PROCESSING "DITHER=YES"
  STATUS ON
END

END

Change History (10)

comment:1 by dmorissette, 18 years ago

Cc: warmerdam@… added
Frank, does this problem ring any bell to you?

comment:2 by fwarmerdam, 18 years ago

No, I don't know what is going on with this.  We will need a configuration
with which to reproduce this problem. 

comment:3 by xslove@…, 18 years ago

if specified BBOX has ratio 1:1 toward specified WIDTH and HEIGHT of result 
image (usual request), then raster layer is not rotated within result image. 
If BBOX has other ratio the raster layer is not rotated

comment:4 by fwarmerdam, 18 years ago

Ah, now this seems quite plausible.  If the aspect ratio is not 1:1 then
a rather special mode has to be turned on. 

If you can provide details on how to reproduce this, I will investigate. 


comment:5 by xslove@…, 18 years ago

well my image specified within raster layer "rastr" is test image (1902x1268 
pixels) - you can create it yourself. Its georeferencing coordinates is 
specified by "rastr.wld" file. It looks that:
89.709857074417116
0.0
42.100000
-95.749460470924021
-688498.9782178218
-1082839.0144039828


The normal request generated by WMS client (Jump-project) looks:
http://127.0.0.1:8080/cgi/mapserv.exe?
map=mywms.map&REQUEST=map&WMTVER=1.0&WIDTH=465&HEIGHT=345&LAYERS=rastr,Sidla&TR
ANSPARENT=TRUE&FORMAT=PNG&BBOX=-683099.75,-1229897.5,-520701.62,-
1109408.5&SRS=EPSG:4818

this produce bad result - the image is not rotated

If I was extended BBOX width by X1, it looks:
http://127.0.0.1:8080/cgi/mapserv.exe?
map=mywms.map&REQUEST=map&WMTVER=1.0&WIDTH=465&HEIGHT=345&LAYERS=rastr,Sidla&TR
ANSPARENT=TRUE&FORMAT=PNG&BBOX=-693099.75,-1229897.5,-520701.62,-
1109408.5&SRS=EPSG:4818

so, the image rotation is correct...


comment:6 by fwarmerdam, 18 years ago

Cc: warmerdam@… removed
Owner: changed from mapserverbugs to fwarmerdam
OK, problem confirmed.  In bad case with DEBUG set on the layer I see:

Layer rastr has rotational coefficients but we are unable to
use them, is projection set?msDrawGDAL(): src=0,277,1741,990, dst=137,0,328,272

The problem seems to be that any render request that goes through
the mapresample.c mechanism results in a literal window load request. 
I will see what can be done. 

comment:7 by fwarmerdam, 18 years ago

Resolution: fixed
Status: newclosed
Radim,

It turned out that things *worked* if they were forced to go through 
the mapresample.c code due to other issues (such as non-square pixels), 
but failed if only the rotated image was pushing for mapresample.c.  
This was due to an old check requiring that the map and layer have
valid projections set.  This is no longer a requirement, so I removed
the check and things seem to work well for all cases. 

I note that PROJ support still needs to be compiled in to support rotated
images, even though PROJ itself isn't used.  But this looks messy to disentangle.

The change is in 4.8 CVS, and is in mapresample.c. 

comment:8 by dmorissette, 18 years ago

Cc: dmorissette@… added

comment:9 by xslove@…, 18 years ago

Oh you are right, I have realized I have not set projection within raster 
layer. This is thing what I have need!!!
Just it is working good! I'm sorry for engagement of all you. but result was 
so uncanny, I didn't come upon the solution. So thanks
Radim

comment:10 by fwarmerdam, 18 years ago

> I'm sorry for engagement of all you

Radim,

On the contrary, you helped me iron out a significant defect
before the 4.8 software is finalized.  You have provided a 
service to the project.  Don't be sorry.

Best regards,
Note: See TracTickets for help on using tickets.