Opened 10 years ago

Last modified 10 years ago

#3179 assigned defect

WMS Client Requests Pixellated

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: 6.0 release
Component: MapServer C Library Version: svn-trunk (development)
Severity: normal Keywords:
Cc: rhow@…, dmorissette

Description

If shp2img is run on the mapfile:

MAP

EXTENT -20037507.0671618 6117014.60076862 -16902886.0729243 8172378.24130428
IMAGECOLOR 255 255 255
SIZE 1072 702
STATUS ON
UNITS METERS
NAME "ddStreaming"
RESOLUTION 96

PROJECTION
  "proj=eqc" "ellps=WGS84" "datum=WGS84" "units=m" "no_defs"   #World_Plate_Carree
END

CONFIG MS_ERRORFILE stderr

WEB
  IMAGEPATH "/tmp/"
END

LAYER
  NAME "prov_bound"
  TYPE RASTER
  STATUS DEFAULT
  DEBUG 1
  CONNECTION "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?"
  CONNECTIONTYPE WMS
  METADATA
    "wms_srs"             "EPSG:4326"
    "wms_name"            "prov_bound"
    "wms_server_version"  "1.1.1"
    "wms_format"          "image/gif"
  END
END

END

a WMS request is made for:

http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAY
ERS=prov_bound&REQUEST=GetMap&SERVICE=WMS&FORMAT=image/gif&STYLES=&HEIGHT=702&VERSION=1.1.1&SRS=EPSG:43
26&WIDTH=1072&BBOX=-179.755953756481,54.936907585729,179.961692060644,73.4268923224927&TRANSPARENT=TRUE
&EXCEPTIONS=application/vnd.ogc.se_inimage

Note the BBOX=-179.755953756481,54.936907585729,179.961692060644,73.4268923224927 which is roughly 360 degrees by 20 degrees while the image is 1072x702, not nearly the same aspect ratio.

As it happens, gmap server doesn't really return the right result (but that's another bug - #3109) but even if it did this would result in a bad map because the resolution is wrong due to the "Stretch over the globe" effect.

The core problem seems to be that the original request "EXTENT -20037507.0671618 6117014.60076862 -16902886.0729243 8172378.24130428" gets transformed out by half a pixel to produce a WMS region (from center of pixels to edge of pixels) and this goes slightly beyond the dateline and causes the extents to wrap in lat/long.

Attachments (2)

datelinepixel.patch (13.2 KB) - added by warmerdam 10 years ago.
preliminary patch reprojecting rects as a polygon
datelinepixel2.patch (13.8 KB) - added by warmerdam 10 years ago.
Updated version of the patch with -180/180 clamping for whole globe.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 10 years ago by warmerdam

Status: newassigned

I'm going to try an implementation of msProjectRect() that operates on it as a polygon shape to take advantage of the dateline wrapping logic and "horizon detection" already implemented for polygons.

comment:2 Changed 10 years ago by rhow

Cc: rhow@… added

Changed 10 years ago by warmerdam

Attachment: datelinepixel.patch added

preliminary patch reprojecting rects as a polygon

Changed 10 years ago by warmerdam

Attachment: datelinepixel2.patch added

Updated version of the patch with -180/180 clamping for whole globe.

comment:3 Changed 10 years ago by warmerdam

As an additional note, it was determined that use of the +over PROJ.4 flag disables PROJ.4's automatic wrapping of longitude to -180 to 180 and helps for these problems substantially.

eg.

PROJECTION
  "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +units=m +over +no_defs"
END

I have incorporated the rectangle as polygon reprojection in trunk (r9786) though I consider it fairly risky. We will have to keep an eye out for problems. See also http://trac.osgeo.org/mapserver/wiki/WorldMappingIssues and http://fwarmerdam.blogspot.com/2010/02/world-mapping.html.

comment:4 Changed 10 years ago by dmorissette

Cc: dmorissette added

comment:5 Changed 10 years ago by dmorissette

Milestone: 6.0 release
Note: See TracTickets for help on using tickets.