Opened 6 years ago

Closed 6 years ago

#2987 closed bug (fixed)

Bing layer's zoom level may be incorrect

Reported by: ahocevar Owned by: euzuro
Priority: minor Milestone: 2.11 Release
Component: Layer Version: SVN
Keywords: Cc:
State: Complete


Because the Bing layer may set its final resolutions array after it is added to the map and the map is rendered, there is a chance that, if it is a base layer, overlays won't align because they are still rendered at a different zoom level. The solution is to call map.zoomTo in the initLayer method, as soon as we have the final resolutions.

Attachments (1)

openlayers-2987.patch (5.5 KB) - added by ahocevar 6 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 6 years ago by ahocevar

  • State set to Review
  • Version changed from 2.10 to SVN

The above patch fixes the issue. It comes with comprehensive tests that show the issue. Tests pass after applying the patch. Thanks for any review.

Changed 6 years ago by ahocevar

comment:2 Changed 6 years ago by ahocevar

Note that this patch also simplifies the way we set the resolutions: instead of maintaining a resolutions array, we just need the maxResolution, because we can calculate each resolution from the maxResolution: maxResolution / Math.pow(2, zoomLevel)

comment:3 Changed 6 years ago by ahocevar

  • Summary changed from Bing layer displays at incorrect zoom level with overlays to Bing layer's zoom level may be incorrect
  • Type changed from feature to bug

comment:4 Changed 6 years ago by tschaub

  • State changed from Review to Commit

Thanks for the continued work on this. Assuming tests pass, please commit.

comment:5 Changed 6 years ago by ahocevar

  • Resolution set to fixed
  • State changed from Commit to Complete
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.