Tiles outside maxExtent being loaded

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Tiles outside maxExtent being loaded

Jon Blower
Hi all,

I've noticed that in my application OpenLayers is requesting tiles
outside the maximum extent of my overlay layer (which is in EPSG:4326
and hence has a maxExtent of -180,-90,180,90).  I've checked using the
Firebug console that the maxExtent is correctly set.  wrapDateLine is
set true.

My map div has dimensions 512px x 400px (width x height).  When zoomed
such that the whole world is visible, I expect 2 tiles to be loaded
(with size 256x256), one for each of the western and eastern
hemispheres.  Instead, OL loads 8 tiles: the two "correct" tiles and
six other tiles - four above and two below the map.  I.e. it is
loading tiles with impossible latitudes.

The incorrect tiles have bounding boxes:
-180,90,0,270 (tile "above" western hemisphere)
0,90,180,270 (above E hem)
-180,-270,0,-90 (below W hem)
0,-270,180,-90 (below E hem)
-180,270,180,450 (two tiles above W hem)
0,270,180,450 (two tiles above E hem)

Is there any way of preventing these tiles from being loaded?  You can
see this effect at http://www.reading.ac.uk/godiva2 (load the web
page, then select an item from the LH menu to create an overlay).

Cheers, Jon


--
--------------------------------------------------------------
Dr Jon Blower Tel: +44 118 378 5213 (direct line)
Technical Director Tel: +44 118 378 8741 (ESSC)
Reading e-Science Centre Fax: +44 118 378 6413
ESSC Email: [hidden email]
University of Reading
3 Earley Gate
Reading RG6 6AL, UK
--------------------------------------------------------------
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Tiles outside maxExtent being loaded

Christopher Schmidt-2
On Fri, May 30, 2008 at 01:48:36PM +0100, Jon Blower wrote:
> I've noticed that in my application OpenLayers is requesting tiles
> outside the maximum extent of my overlay layer (which is in EPSG:4326
> and hence has a maxExtent of -180,-90,180,90).  I've checked using the
> Firebug console that the maxExtent is correctly set.  wrapDateLine is
> set true.

wrapDateLine forces displayOutsideMaxExtent, which is why you are seeing
the behavior you are seeing.

>
> Is there any way of preventing these tiles from being loaded?

Turn off wrapDateLine.

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Tiles outside maxExtent being loaded

Jon Blower
Hi Chris,

Thanks for the reply.  Is it not possible (logically at least) to have
wrapDateLine=true and displayOutsideMaxExtent=false?  This seems to
make a lot of sense for the very common case of EPSG:4326.

Alternatively is there a method I can override to prevent tiles
outside the latitude range [-90,90] being loaded (e.g. by subclassing
Layer.WMS)?  I'm keen to do this because having 8 requests to my WMS
server (even if 6 of them are quickly rejected) not only causes
increased load on my server but also uses up some of the web browser's
image loading threads, slowing up my application considerably.

Cheers, Jon

On Fri, May 30, 2008 at 3:24 PM, Christopher Schmidt
<[hidden email]> wrote:

> On Fri, May 30, 2008 at 01:48:36PM +0100, Jon Blower wrote:
>> I've noticed that in my application OpenLayers is requesting tiles
>> outside the maximum extent of my overlay layer (which is in EPSG:4326
>> and hence has a maxExtent of -180,-90,180,90).  I've checked using the
>> Firebug console that the maxExtent is correctly set.  wrapDateLine is
>> set true.
>
> wrapDateLine forces displayOutsideMaxExtent, which is why you are seeing
> the behavior you are seeing.
>
>>
>> Is there any way of preventing these tiles from being loaded?
>
> Turn off wrapDateLine.
>
> Regards,
> --
> Christopher Schmidt
> MetaCarta
>



--
--------------------------------------------------------------
Dr Jon Blower Tel: +44 118 378 5213 (direct line)
Technical Director Tel: +44 118 378 8741 (ESSC)
Reading e-Science Centre Fax: +44 118 378 6413
ESSC Email: [hidden email]
University of Reading
3 Earley Gate
Reading RG6 6AL, UK
--------------------------------------------------------------
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Tiles outside maxExtent being loaded

Christopher Schmidt-2
On Fri, May 30, 2008 at 03:37:12PM +0100, Jon Blower wrote:
> Hi Chris,
>
> Thanks for the reply.  Is it not possible (logically at least) to have
> wrapDateLine=true and displayOutsideMaxExtent=false?  This seems to
> make a lot of sense for the very common case of EPSG:4326.

Correct. wrapDateLine true and displayOutsideMaxExtent false can not be
used in combination.

> Alternatively is there a method I can override to prevent tiles
> outside the latitude range [-90,90] being loaded (e.g. by subclassing
> Layer.WMS)?  I'm keen to do this because having 8 requests to my WMS
> server (even if 6 of them are quickly rejected) not only causes
> increased load on my server but also uses up some of the web browser's
> image loading threads, slowing up my application considerably.

Not that I'm aware of.

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Tiles outside maxExtent being loaded

Eric Lemoine
In reply to this post by Christopher Schmidt-2
On Fri, May 30, 2008 at 4:24 PM, Christopher Schmidt
<[hidden email]> wrote:
> On Fri, May 30, 2008 at 01:48:36PM +0100, Jon Blower wrote:
>> I've noticed that in my application OpenLayers is requesting tiles
>> outside the maximum extent of my overlay layer (which is in EPSG:4326
>> and hence has a maxExtent of -180,-90,180,90).  I've checked using the
>> Firebug console that the maxExtent is correctly set.  wrapDateLine is
>> set true.
>
> wrapDateLine forces displayOutsideMaxExtent, which is why you are seeing
> the behavior you are seeing.

Chris, sorry for the stupid question but why does wrapDateLine force
displayOutsideMaxExtent? What would not function if one creates a
layer with wrapeDateLine:true and then does
layer.displayOutsideMaxExtent = false? One will end up with missing
tiles?

Thanks,

--
Eric
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Tiles outside maxExtent being loaded

Christopher Schmidt-2
On Sun, Jun 01, 2008 at 02:10:46PM +0200, Eric Lemoine wrote:

> On Fri, May 30, 2008 at 4:24 PM, Christopher Schmidt
> <[hidden email]> wrote:
> > On Fri, May 30, 2008 at 01:48:36PM +0100, Jon Blower wrote:
> >> I've noticed that in my application OpenLayers is requesting tiles
> >> outside the maximum extent of my overlay layer (which is in EPSG:4326
> >> and hence has a maxExtent of -180,-90,180,90).  I've checked using the
> >> Firebug console that the maxExtent is correctly set.  wrapDateLine is
> >> set true.
> >
> > wrapDateLine forces displayOutsideMaxExtent, which is why you are seeing
> > the behavior you are seeing.
>
> Chris, sorry for the stupid question but why does wrapDateLine force
> displayOutsideMaxExtent? What would not function if one creates a
> layer with wrapeDateLine:true and then does
> layer.displayOutsideMaxExtent = false? One will end up with missing
> tiles?

The 'wrapped' tiles are, in actuality, still going from (for example)
-360 to -180 in the 'mind' of OpenLayers. We just fake the *request*
bbox, not the place the tile actually thinks of itself as being: without
displayOutsideMaxExtent, this obviously wouldn't work.

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Tiles outside maxExtent being loaded

Eric Lemoine
On Sun, Jun 1, 2008 at 3:53 PM, Christopher Schmidt
<[hidden email]> wrote:

> On Sun, Jun 01, 2008 at 02:10:46PM +0200, Eric Lemoine wrote:
>> On Fri, May 30, 2008 at 4:24 PM, Christopher Schmidt
>> <[hidden email]> wrote:
>> > On Fri, May 30, 2008 at 01:48:36PM +0100, Jon Blower wrote:
>> >> I've noticed that in my application OpenLayers is requesting tiles
>> >> outside the maximum extent of my overlay layer (which is in EPSG:4326
>> >> and hence has a maxExtent of -180,-90,180,90).  I've checked using the
>> >> Firebug console that the maxExtent is correctly set.  wrapDateLine is
>> >> set true.
>> >
>> > wrapDateLine forces displayOutsideMaxExtent, which is why you are seeing
>> > the behavior you are seeing.
>>
>> Chris, sorry for the stupid question but why does wrapDateLine force
>> displayOutsideMaxExtent? What would not function if one creates a
>> layer with wrapeDateLine:true and then does
>> layer.displayOutsideMaxExtent = false? One will end up with missing
>> tiles?
>
> The 'wrapped' tiles are, in actuality, still going from (for example)
> -360 to -180 in the 'mind' of OpenLayers. We just fake the *request*
> bbox, not the place the tile actually thinks of itself as being: without
> displayOutsideMaxExtent, this obviously wouldn't work.

I'm not familiar with the wrapdateline code, thanks for the explanation Chris.

Cheers,

--
Eric
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Tiles outside maxExtent being loaded

Jon Blower
Hi Chris,

Thanks for the clarification.  FYI, I worked around this issue by
creating a subclass of OpenLayers.Layer.WMS and overriding the
getURL() method.  The new method checks the latitude bounds, setting
the URL to that of a fixed blank image if out of bounds.  This blank
image is cached by the browser, reducing server round-trips
significantly.

See http://behemoth.nerc-essc.ac.uk/ncWMS/js/WMS1_1_1.js.  (You might
also notice that I've added a little extra sophistication to allow
different values of the key used for SRS.  WMS1.1.1 uses "SRS" while
WMS1.3.0 uses "CRS".  I also have a WMS1_3 class that subclasses
WMS1_1_1 and takes advantage of this).

Cheers, Jon

On Sun, Jun 1, 2008 at 7:34 PM, Eric Lemoine <[hidden email]> wrote:

> On Sun, Jun 1, 2008 at 3:53 PM, Christopher Schmidt
> <[hidden email]> wrote:
>> On Sun, Jun 01, 2008 at 02:10:46PM +0200, Eric Lemoine wrote:
>>> On Fri, May 30, 2008 at 4:24 PM, Christopher Schmidt
>>> <[hidden email]> wrote:
>>> > On Fri, May 30, 2008 at 01:48:36PM +0100, Jon Blower wrote:
>>> >> I've noticed that in my application OpenLayers is requesting tiles
>>> >> outside the maximum extent of my overlay layer (which is in EPSG:4326
>>> >> and hence has a maxExtent of -180,-90,180,90).  I've checked using the
>>> >> Firebug console that the maxExtent is correctly set.  wrapDateLine is
>>> >> set true.
>>> >
>>> > wrapDateLine forces displayOutsideMaxExtent, which is why you are seeing
>>> > the behavior you are seeing.
>>>
>>> Chris, sorry for the stupid question but why does wrapDateLine force
>>> displayOutsideMaxExtent? What would not function if one creates a
>>> layer with wrapeDateLine:true and then does
>>> layer.displayOutsideMaxExtent = false? One will end up with missing
>>> tiles?
>>
>> The 'wrapped' tiles are, in actuality, still going from (for example)
>> -360 to -180 in the 'mind' of OpenLayers. We just fake the *request*
>> bbox, not the place the tile actually thinks of itself as being: without
>> displayOutsideMaxExtent, this obviously wouldn't work.
>
> I'm not familiar with the wrapdateline code, thanks for the explanation Chris.
>
> Cheers,
>
> --
> Eric
>



--
--------------------------------------------------------------
Dr Jon Blower Tel: +44 118 378 5213 (direct line)
Technical Director Tel: +44 118 378 8741 (ESSC)
Reading e-Science Centre Fax: +44 118 378 6413
ESSC Email: [hidden email]
University of Reading
3 Earley Gate
Reading RG6 6AL, UK
--------------------------------------------------------------
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users