Ticket #2590 (closed bug: wontfix)
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

