[OSM-dev] Show Image of Data not Available where Tiles are Empty
Mitja Kleider
mitja at kleider.name
Fri Jul 9 10:58:21 BST 2010
Am Freitag, den 09.07.2010, 01:38 +0200 schrieb Peter Körner:
> Am 09.07.2010 00:07, schrieb PARVEEN ARORA:
> > I am trying to show a default image of data not available or data
> > coming soon
> > where tiles are empty or not available with the help of following script:
> >
> > http://www.openstreetmap.org/openlayers/OpenStreetMap.js
> >
> > I have added this script to my index.html page
> > but this script is not working or i do not know how it can work
> > correctly.
> You can take a look at [1] where this script is used.
Just a short remark: OpenLayers.Layer.OSM is now part of OpenLayers 2.9,
utilizing OpenLayers.Layer.XYZ
http://dev.openlayers.org/releases/OpenLayers-2.9.1/doc/apidocs/files/OpenLayers/Layer/XYZ-js.html
You will still need to configure the empty tiles.
> > Is there any other way to show the default image in empty tiles ?
> > Please Help..
>
> It seems this is done by the code snippet around
> OpenLayers.Util.onImageLoadError. There is a if-switch that uses
> this.src. to limit the error-image to tiles loaded from
> *.openstreetmap.org. You could override this behaviour by putting a
> <script />-Tag after the <script />-Tag that loads OpenStreetMap.js like
> this:
>
> <script type="text/javascript">
> OpenLayers.Util.onImageLoadError = function() {
> this.src = "/url/to/your/error.png
> };
> </script>
>
>
> Peter
>
> [1] <http://toolserver.org/~osm/styles/>
Mitja
More information about the dev
mailing list