Ticket #1127 (closed bug: invalid)

Opened 6 years ago

Last modified 4 years ago

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

Reported by: johnwebbcole Owned by:
Priority: major Milestone: 2.8 Release
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 Download (475 bytes) - added by johnwebbcole 6 years ago.
patch for OL 2.5 or current Trunk to use maxResolution option on layer creation

Change History

Changed 6 years ago by johnwebbcole

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

Changed 5 years ago 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?

Changed 4 years ago by crschmidt

  • status changed from new to closed
  • resolution set to invalid
  • milestone set to 2.8 Release

maxResolution and resolutions array together are incompatible. If you want something to happen differently with that, you'll need more description than there is here.

Note: See TracTickets for help on using tickets.