[OpenLayers-Users] Ancillary question on the tileerror event handling - overriding default css behaviour.[SEC=UNOFFICIAL]

Robert Mcauliffe r.mcauliffe at bom.gov.au
Sun Nov 4 20:00:44 PST 2012


Phil,

You try overriding the css in your event handler:

layer.events.register("tileerror",layer,function(evt){
    evt.tile.setImgSrc("images/empty.png");
    var imgDiv = evt.object.imgDiv;
    imgDiv.style.visibility='visible';
    return false;
});

Note that I haven't actually tested this, so YMMV and good luck!

(also note that if you use some sort of DOM library like jQuery, then the 4th line should probably use whatever css-setting facility that library has)

Cheers,

Rob

-----Original Message-----
From: openlayers-users-bounces at lists.osgeo.org [mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of Phil Scadden
Sent: Monday, 5 November 2012 2:09 PM
To: openlayers-users at lists.osgeo.org
Subject: [OpenLayers-Users] Ancillary question on the tileerror event handling - overriding default css behaviour.

Mostly, i deal with load errors from tiles with a css entry .olImageLoadError {
   display: none;
}

For my osm, I wanted to deal with it a blank ocean tile which I did with
             layer.events.register("tileerror",layer,function(evt){
               evt.tile.setImgSrc("images/empty.png");
               return false;
               });

However, the css entry turns off the tile! (works fine if I remove the css). Is there an easy way to change that?
--
Phil Scadden, GNS Science Ltd 764 Cumberland St, Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232

Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.

_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


More information about the Users mailing list