R: Re: Re: Re: Re: [OpenLayers-Users] Capture Tile information

francescoboccacci at libero.it francescoboccacci at libero.it
Thu Feb 16 10:15:24 EST 2012


Hi Adreas, how is possible capture this information?

I use this code:


layer.events.register("tileloaded", layer, function() {
                if (document.getElementsByClassName("olImageLoadError").
length) {
                       error+=1;
                 }
    });
 By this way i count the number of tiles that aren't loaded. How can capture 
the tiles coming from the  cache?

Thanks in advance

Francesco


>----Messaggio originale----
>Da: ahocevar at opengeo.org
>Data: 16/02/2012 16.08
>A: "francescoboccacci at libero.it"<francescoboccacci at libero.it>
>Cc: <ramotswa at gmail.com>, <openlayers-users at lists.osgeo.org>
>Ogg: Re: Re: Re: Re: [OpenLayers-Users] Capture Tile information
>
>No, this is not possible. But the tileloaded event will also fire when
>the image comes from the cache.
>
>Andreas.
>
>On Thu, Feb 16, 2012 at 2:56 PM, francescoboccacci at libero.it
><francescoboccacci at libero.it> wrote:
>> Good solution.. the last question is:
>> i can capture if an error is occurs during the tile loading 
(olImageLoadError)
>> , but is possible to check if the tile is already present in my cache (304
>> response from server)?
>> Thanks again ..
>>
>> Francesco
>>
>>>----Messaggio originale----
>>>Da: ramotswa at gmail.com
>>>Data: 16/02/2012 14.48
>>>A: "francescoboccacci at libero.it"<francescoboccacci at libero.it>
>>>Cc: <bamerbalazs at gmail.com>, <openlayers-users at lists.osgeo.org>
>>>Ogg: Re: Re: Re: [OpenLayers-Users] Capture Tile information
>>>
>>>So if you had an OSM layer.
>>>
>>>Register an event on tileloaded on it
>>> OSMM.events.register("tileloaded", function (e) {
>>>                var myVar= e;
>>>}
>>>
>>>and then somewhere in "myVar" you need to check if "olImageLoadError"
>>>is present. One area could be myVar.element.childNodes[0].innerHTML
>>>
>>>for me that is:
>>>"<img id="OpenLayersDiv77" style="position: relative; width: 256px;
>>>height: 256px; " class="olTileImage olImageLoadError" src=....>"
>>>
>>>You can do a text comparison to find if olImageLoadError is in there
>>>and report something back accordingly.
>>>
>>>I have not ever implemented this nor do I think it is a particularly
>>>good solution, but it should do what you are after.
>>>
>>>Toby
>>>
>>>
>>>
>>>On 16 February 2012 13:08, francescoboccacci at libero.it
>>><francescoboccacci at libero.it> wrote:
>>>> Hi, can you tell me how look at the css class? can you explain it more
>> clear?
>>>> Can you write a simple example ?
>>>> Thanks in advance...
>>>>
>>>> Francesco
>>>>
>>>>>----Messaggio originale----
>>>>>Da: ramotswa at gmail.com
>>>>>Data: 16/02/2012 14.02
>>>>>A: "francescoboccacci at libero.it"<francescoboccacci at libero.it>
>>>>>Cc: <bamerbalazs at gmail.com>, <openlayers-users at lists.osgeo.org>
>>>>>Ogg: Re: Re: [OpenLayers-Users] Capture Tile information
>>>>>
>>>>>No I understand what you are trying to do, but you can,
>>>>>programatically, look at the css class of every tile that comes in
>>>>>apparently.
>>>>>
>>>>>On 16 February 2012 12:53, francescoboccacci at libero.it
>>>>><francescoboccacci at libero.it> wrote:
>>>>>> ye..with firebug i can see all requests .. but i'd like to capture the
>>>> response
>>>>>> from the server if i'm using the tile from my cache or from server
(fresh
>>>> tile).
>>>>>> I don't know if is possible but it will be very interesting.Maybe we 
have
>>>> to
>>>>>> work into openlayers code. Thanks
>>>>>>
>>>>>> Francesco
>>>>>>
>>>>>>>----Messaggio originale----
>>>>>>>Da: bamerbalazs at gmail.com
>>>>>>>Data: 16/02/2012 13.38
>>>>>>>A: <openlayers-users at lists.osgeo.org>
>>>>>>>Ogg: Re: [OpenLayers-Users] Capture Tile information
>>>>>>>
>>>>>>>Hi Imran,
>>>>>>>
>>>>>>>> You can see your http request using FireBug, if you are using 
FireFox.
>>>>>>>
>>>>>>>Yes, but I thought a check during runtime from JavaScript. So that
>>>>>>>instead of displaying pink tiles, I would write a message about the
>>>>>>>problem with X layer.
>>>>>>>
>>>>>>>best regards: Balázs
>>>>>>>_______________________________________________
>>>>>>>Users mailing list
>>>>>>>Users at lists.osgeo.org
>>>>>>>http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Users mailing list
>>>>>> Users at lists.osgeo.org
>>>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>>
>>>>
>>>>
>>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
>
>-- 
>Andreas Hocevar
>OpenGeo - http://opengeo.org/
>Expert service straight from the developers.
>




More information about the Users mailing list