Opened 15 years ago

Last modified 15 years ago

#3111 assigned defect

WMS Layer Reprojection not always sensible - misses stuff near dateline.

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone:
Component: MapServer C Library Version: unspecified
Severity: normal Keywords: reprojection
Cc:

Description

Rendering the following map with

 shp2img -m bug.map -o out.jpg 

produces a blue image with two broad vertical white stripes on what would be the east and west dateline if there was context.

MAP
EXTENT -37413785.1088017 -24459849.0512563 37413785.1088017 24459849.0512563
IMAGECOLOR 255 255 255
SIZE 956 625
STATUS ON
UNITS DD
NAME "name"

PROJECTION
 "+proj=merc +datum=WGS84"
END

WEB
  IMAGEPATH "/tmp/"
END

OUTPUTFORMAT
  NAME jpeg
  DRIVER "GD/JPEG"
  MIMETYPE "image/jpeg"
  IMAGEMODE RGB
  EXTENSION "jpg"
  FORMATOPTION QUALITY=75
  FORMATOPTION "INTERLACE=OFF"
END 

LAYER
  NAME "lyr"
  CONNECTION "http://labs.metacarta.com/wms/vmap0?"
  CONNECTIONTYPE WMS
  TYPE RASTER
  STATUS DEFAULT
  METADATA
    "wms_srs"             "EPSG:4326"
    "wms_server_version"  "1.1.1"
    "wms_format"          "image/jpeg"
    "wms_name"            "ocean"
    "wms_connectiontimeout" "120"
  END
#  PROCESSING "LOAD_WHOLE_IMAGE=YES"
END

END

Change History (2)

comment:1 by warmerdam, 15 years ago

Status: newassigned
Summary: WMS Layer RWMS Layer Reprojection not always sensible - misses stuff near dateline.

There are actually a couple problems essentially related to reprojecting regions from mercator to latlong and doing the operation along region bounds with some sampling density.

If the PROCESSING directive is uncommented the results are substantially better as this avoids a problem in msTransformMapToSource() when the fetched WMS image is being processed. In fact, I can think of no reason that this processing directive should not be forced for all WMS layers. I'll try and followup on this as part of this ticket.

But even with that change the actual WMS request issued is still not for the whole world as it ought - instead it is:

&BBOX=-178.218524639424,-87.5565240606026,178.218524639424,87.5565240606026

Note this does not go quite to the edges, and this is because when msBuildWMSLayerURL() calls msReprojectRect() to reproject the mercator bounds into lat/long it is also done on a sampling grid and misses a bit (it is a denser sampling grid than the other function).

I'm not so sure what to do about this.

comment:2 by warmerdam, 15 years ago

I have made the LOAD_WHOLE_IMAGE processing option apply by default for WMS layers in trunk (r9281).

Note: See TracTickets for help on using tickets.