Opened 15 years ago

Last modified 14 years ago

#3265 new defect

Scale dependent layer switching error with Mercator (EPSG:900913) and LatLong (ESPG:4326)

Reported by: paalkr Owned by: mapserverbugs
Priority: normal Milestone:
Component: WMS Server Version: 5.4
Severity: normal Keywords:
Cc: sdlime

Description

Requesting maps with the same area (extent) and size (with * hight) in mercator (EPSG:900913) and latlong (ESPG:4326) turns on layers at a wrong scale compared with maps requested in UTM zone 33 (EPSG:32633). Se attachments for illustration.

A pseudo mapfile could look like this

RESOLUTION 96

LAYER 1
   MINSCALE 2000000

LAYER 2
   MAXSCALE 2000000
   MINSCALE 800000

LAYER 3
   MAXSCALE 800000
   MINSCALE 100000

LAYER 4
   MAXSCALE 100000

The mapfile projection is set to EPSG:32633, and all the layers are also set to ESPG:32633

The WMS is available to the public (limited to 300 request pr client IP address pr day), so feel free to try out http://openwms.statkart.no/skwms1/wms.topo2?.

Regards, Pål Kristensen

Attachments (2)

partial_projection.patch (29.9 KB ) - added by relet 14 years ago.
a possible approach
projection.factor.patch (14.6 KB ) - added by relet 14 years ago.
or using a single multiplication factor

Download all attachments as: .zip

Change History (6)

comment:1 by paalkr, 15 years ago

The attachment exceeded the limit for maximum file size, so I uploaded the images to filedropper. Download link http://www.filedropper.com/screendumps

Pål

by relet, 14 years ago

Attachment: partial_projection.patch added

a possible approach

comment:2 by relet, 14 years ago

I have begun to implement an approach proposed here.

It does not change the projection vs. scale limit issue itself. I would second that it stems from singular scale limits not being the right tool if you work with multiple projections. However, it provides a way to specify individual layer scale limits for each projection.

Since I am new to the mapserver and its architecture, I would welcome any comments on the patch. Especially, if you think that this is the right place to have this setting.

In summary, what it does is: It allows you to specify projection specific max/min scale denominators in the format

MAXSCALE "10000 epsg:900913"
MAXSCALE "15000 epsg:32633"
MAXSCALE "18000 *"

The code '*' is used as a default, for any projection that does not have specific scale denominators. Any scale denominator in the previous format

MAXSCALE 18000

will be mapped to this set as well.

Internally, it replaces the scale denominators in (currently only) the layerObj with a hashtable epsg -> scaleObj. Functions like mapdraw.c can look up the current limits in this table using the projection identifier used by the proj4 library.

With the appended patch, this should work for the keywords maxscale(denom) and minscale(denom) in the layer object, and perform the checks in mapdraw.c. In all other places, the default '*' layer is used.

I would plan to complete the patch if you think this is a reasonable approach.

comment:3 by dmorissette, 14 years ago

Cc: sdlime added

Added Steve to CC to get his feedback.

About your proposed approach: The use of EPSG codes in the scale rules makes this quite WMS-specific, so it's hard to justify changing the general mapfile syntax for a WMS-specific feature.

I'd suggest you bring up your idea on the mapserver-dev list to discuss it there with the other devs.

by relet, 14 years ago

Attachment: projection.factor.patch added

or using a single multiplication factor

comment:4 by relet, 14 years ago

I have appended another possible approach. It uses a single factor to correct the limits for the scale denominators. It follows the direction discussed here:

http://osgeo-org.1803224.n2.nabble.com/Re-3265-Scale-dependent-layer-switching-error-with-Mercator-td4966902.html

The factor may be replaced by one automatically calculated by the proj4 library eventually. Currently, it is set in the web metadata section as, for example

           "wms_scalefactor_epsg:32633" "1.0"
           "wms_scalefactor_epsg:900913" "2.2"

Any projection not specified defaults to a 1.0 factor.

Note: See TracTickets for help on using tickets.