OpenLayers OpenLayers

Ticket #1127 (new bug)

Opened 10 months ago

Last modified 9 months ago

cannot set maxResolution as an option on layer creation, it is always overridden in initResolutions

Reported by: johnwebbcole Assigned to:
Priority: major Milestone:
Component: general Version: 2.5
Keywords: Cc:
State:

Description

I have a utility that emits the JS needed for creating OL layers, an option is to emit the resolutions available to each layer.

An issue I ran into is that if you pass in a full array of resolutions, and try to set a maxResolution, the initResolutions function resets maxResolution to resolutions[0]. It appears that confProps.maxResolution is set, so I've modified initResolutions to use that value instead of the top of the resoltuions array.

This fixes my issue with the LayerSelector and not being able to have a layer out of range from the layers options.

I can easily see possible side effects if other code is assuming that the max resolution of a layer is equal to the first value in the resolution array but a quick find in files didn't turn up anyone using resolutions[0].

This issue might also cause a maxScale option to be effectively ignored as well (as the inRange is set from the maxResolution value and not the maxScale value).

Not sure on everyone else's priority but it was major to me :-) It took a while to figure out why an option was being ignored.

Attachments

Layer.js.patch (475 bytes) - added by johnwebbcole on 11/07/07 11:07:56.
patch for OL 2.5 or current Trunk to use maxResolution option on layer creation

Change History

11/07/07 11:07:56 changed by johnwebbcole

  • attachment Layer.js.patch added.

patch for OL 2.5 or current Trunk to use maxResolution option on layer creation

12/02/07 14:42:58 changed by elemoine

The attached patch doesn't seem correct to me. The patch sets the layer's maxResolution property to confProps.maxResolution, for any case. If the user hasen't specified maxResolution, the layer's maxResolution property will therefore be garbage.

johnwebbcole, could you elaborate on the issue you're seeing? I myself see nothing wrong with the current code. Would you set both the resolutions array (or the scales array) et maxResolution?