You could catch the 'tileerror' event on the layer.
I think that tileerror is relatively new, but I may be mistaken.
It would go something like this:
layer = new OL.WMS(...);
layer.events.register('tileerror', null, function () {
this.setVisibility(false);
alert('oops!');
});
On 10/24/2013 11:03 AM, Schweitzer, Peter wrote:
I'm using shaded relief from The National Map as a base layer, but
today it seems that The National Map isn't serving those data, so I'm
getting the infamous pink tiles. I can turn them off manually using a
call to layer.setVisibility(false). But I'd prefer that the users not
have to do this themselves. Is there any way I could write a test in
my Javascript code that would determine whether or not this layer is
really available, and simply make the layer invisible if it isn't?
http://mrdata.usgs.gov/general/map.html
Peter
--
Greg Allensworth, Senior Web GIS Developer
BS A+ Network+ Security+ Linux+ Server+
GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510 San Francisco CA 94104
PH: 415-979-0343 x302 FX: 415-979-0371 email: [email protected]
Web: www.GreenInfo.org www.MapsPortal.org
Subscribe to MapLines, our e-newsletter, at www.GreenInfo.org
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users