[OpenLayers-Users] Missing tiles in OSM map

Andreas Hocevar ahocevar at opengeo.org
Wed Mar 14 10:21:40 EDT 2012


Hi,

this no longer works with recent versions (master and upcoming 2.12).
Instead, just add the following to your application's css:

.olImageLoadError {
    background-color: transparent !important;
}

If you want an image showing something like "No imagery for this
region at the current zoom level", you can also set a
background-image.

Andreas.

On Wed, Mar 14, 2012 at 3:14 PM, Alessandro Candini <candini at meeo.it> wrote:
> Ok, I solved this issue with the following lines:
>
> OpenLayers.Util.onImageLoadError = function() {
>    this.src = "http://localhost/static/img/missingTile.png";
> };
>
> Where missingTile.png is a completely transparent image of size 256x256.
>
> The visualization is now perfect on every browser, but using firebug on
> Firefox I see that every missing tile produces a 404 error anyway.
> Can this lead to performance issues and is it possible to avoid these calls?
>
>
>> Hi list.
>> I produce tiles using mapnik (www.mapnik.org) and I use the following map
>> definition:
>>
>> var map = new OpenLayers.Map({
>>        div: "map",
>>        allOverlays: true,
>>        maxExtent: bounds,
>>        projection: fromProj,
>>        displayProjection: toProj,
>>        allowSelection: true,
>>        controls: [new OpenLayers.Control.PanZoomBar(), new
>> OpenLayers.Control.Navigation()],
>>        });
>>
>> var layer = new OpenLayers.Layer.OSM(
>>            layer_dir,
>>            "tiles/${z}/${x}/${y}.png",
>>            {zoomLevels: maxZoom, zoomOffset: minZoom, resolutions: res}
>>        );
>>
>> map.addLayer(layer);
>>
>> The problem is that I have a visualization issue in IE and Chrome: the
>> missing tiles are represented as pink squares.
>> Instead in Firefox the visualization is perfect  because it simply uses a
>> white background when the tile is missing.
>>
>> Is there a map or layer parameter to visualize as white the missing tiles?
>>
>> Thanks in advance,
>>
>> Alessandro
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
>
> --
> Alessandro Candini
> MEEO S.r.l.
> Via Saragat 9
> I-44122 Ferrara, Italy
> Tel: +39 0532 1861501
> Fax: +39 0532 1861637
> http://www.meeo.it
>
> ========================================
> "ATTENZIONE:le informazioni contenute in questo messaggio sono
> da considerarsi confidenziali ed il loro utilizzo è riservato unicamente
> al destinatario sopra indicato. Chi dovesse ricevere questo messaggio
> per errore è tenuto ad informare il mittente ed a rimuoverlo
> definitivamente da ogni supporto elettronico o cartaceo."
>
> "WARNING:This message contains confidential and/or proprietary
> information which may be subject to privilege or immunity and which
> is intended for use of its addressee only. Should you receive this
> message in error, you are kindly requested to inform the sender and
> to definitively remove it from any paper or electronic format."
>
>
> _______________________________________________
> 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