Ticket #1574 (new bug)

Opened 5 years ago

Last modified 4 years ago

Lots of spurious tiles get loaded when changing base layer to one with a new projection

Reported by: jonblower Owned by: edgemaster
Priority: critical Milestone: 2.13 Release
Component: Map Version: 2.6
Keywords: projections Cc: jdb@…, grand.edgemaster@…
State:

Description

I have an OL2.6 application that uses base layers in different map projections. The map is initially constructed with a base layer in lat-lon (EPSG:4326). If I change the base layer to a layer in polar stereographic projection (EPSG:32661) the map loads a whole load (up to 40) of spurious tiles. This effect can be seen by loading the attached example web page and using Firebug (or similar) to examine the outgoing GetMap requests. The spurious tiles have a bounding box that is inappropriate for the current zoom level and map extent (this shows up clearly because the extents for 4326 and 32661 are very different in their native units).

The problem appears using Firefox 2 on Windows XP. It is likely that the problem also occurs on other systems but I have not tested this.

Registering an event listener for changebaselayer does not help: it seems that the spurious tiles are loaded anyway.

Attachments

testProj.html Download (2.4 KB) - added by jonblower 5 years ago.
HTML file that shows this bug in action
patch-1574-r7329-A0.diff Download (3.5 KB) - added by elemoine 5 years ago.
patch-1574-r9779-A1.diff Download (7.7 KB) - added by elemoine 4 years ago.

Change History

Changed 5 years ago by jonblower

HTML file that shows this bug in action

Changed 5 years ago by edgemaster

  • cc grand.edgemaster@… added

I'm interested in this due to my work on #1249

Changed 5 years ago by elemoine

Changed 5 years ago by elemoine

I attached a quick-and-dirty patch which fixes the problem seen in the testProj.html example. The patch needs rework, it's just there to show where in the code the bug lies.

Changed 5 years ago by crschmidt

  • priority changed from minor to critical

Changed 5 years ago by tschaub

  • owner set to tcoulter

Changed 5 years ago by tcoulter

@jonblower,

I applied your patch, and I'm having trouble seeing the fix. From my end, using testProj.html, switching the base layer does cause spurious tiles to be loaded; however, with the patch, it still seems to load spurious tiles.

I'm not wholly knowledgeable on projections and how they affect base layers -- someone else may need to take a look.

Changed 5 years ago by jonblower

Thanks tcoulter, but it wasn't my patch, it was Eric Lemoine's - he did say that it was just to show where the bug was rather than a proper fix.

Changed 5 years ago by edgemaster

Since I want to try and get #1249 into 2.7, I'll look at this while I am working on it this coming week.

Changed 5 years ago by euzuro

  • owner changed from tcoulter to edgemaster

Changed 5 years ago by euzuro

  • milestone changed from 2.7 Release to 2.8 Release

Moving to 2.8 for lack of activity

Changed 4 years ago by crschmidt

  • milestone changed from 2.8 Release to 2.9 Release

Not touched in 2.7, bumping.

Changed 4 years ago by elemoine

Changed 4 years ago by elemoine

with patch-1574-r9779-A1.diff Download setBaseLayer reprojects the center of the map if the projection of the new base layer isn't the same as that of the old base layer.

I actually don't feel confortable with having this in OpenLayers, especially because the reprojection may not possible, for example [-180, -90, 180, 90] (EPSG:4326) cannot be transformed in EPSG:900913 coordinates, because 900913 does not cover the poles. Reprojecting coordinates isn't something OpenLayers currently does internally (for its own needs), and I'm not sure this is something we'd like to change.

Anyway, I thought I could attach my patch to this ticket, for reference.

Note: See TracTickets for help on using tickets.