Ticket #2590 (closed bug: wontfix)

Opened 3 years ago

Last modified 3 years ago

incorrect map units with default projection

Reported by: madair Owned by: euzuro
Priority: minor Milestone: 2.10 Release
Component: Layer Version: 2.9
Keywords: Cc:
State: Review

Description

In the case where: - Proj4js is loaded - map layer has units (other than degrees) and extent specified, but no projection code

then the projection object defaults to EPSG:4326 and units get set to 'degrees' and all the scale calculations are messed up. This can be demonstrated with the MapGuide layer example with the following settings:

var extent = new OpenLayers.Bounds(-2200000, -712631, 3072800, 3840000);
var mapOptions = {

maxResolution: 'auto'

};
map = new OpenLayers.Map( 'map2', mapOptions );
var options = {

isBaseLayer: true, maxExtent: extent, units: 'm', buffer: 1, useOverlay: false, useAsyncOverlay: false, singleTile: true

};
var params = {

mapdefinition: ' Library://Samples/Gmap/Maps/gmap.MapDefinition'

};
var layer = new OpenLayers.Layer.MapGuide( "MapGuide OS untiled baselayer", url, params, options );
map.addLayer(layer);

The attached patch fixes the issue by getting the units value from layer options before getting it from the projection object

Attachments

layerUnits.patch Download (0.6 KB) - added by madair 3 years ago.

Change History

Changed 3 years ago by madair

Changed 3 years ago by madair

  • state set to Review

Changed 3 years ago by crschmidt

  • status changed from new to closed
  • resolution set to wontfix

This is clearly a bug in configuration -- the layer is being defined as the default projection (4326) and not being overridden. Your new suggested behavior will break if the user specifies the projection, but no units, and I think cases where users specify the projection are more common.

If you really want this to work, then set a null projection or something; this configuration is broken, and this patch changes the default behavior that most maps depend on. Configuring a change in units/extent without configuring a change in projection is a mistake in the application.

Note: See TracTickets for help on using tickets.