0

I've created a map using openlayers contains osm, google layers and some vector features, On loading it shows two errors like: GET http://tile.openstreetmap.org/0/0/1.png 404 (Not Found). How to prevent this , I've googled it, and i can't understand what is the exact problem and how to solve this please help me.

3 Answers 3

3

You are asking for the second tile (in the y direction) in zoom level 0. It only has one tile at that level (at http://tile.openstreetmap.org/0/0/0.png).

Something is wrong with your code, or the js you are importing.

2

you cant prevent this. it says that the server you have used for openstreetmap dont have image at this url.

but you can use this code for image loading error:

OpenLayers.Util.onImageLoadError = function(){
           this.src='http://www.openlayers.org/api/img/blank.gif';
};

i hope it helps you...

4
  • Shows a new error Failed to load resource: the server responded with a status of 404 (Not Found).
    – bios
    Commented Aug 14, 2012 at 11:02
  • check your all paths whether they are valid or invalid.
    – urcm
    Commented Aug 14, 2012 at 11:08
  • I've not used paths to create map only added two scripts: <script src="maps.google.com/maps/api/…> <script src="openlayers.org/api/OpenLayers.js"></script>
    – bios
    Commented Aug 14, 2012 at 11:20
  • 1
    @Aragon, onImageLoadError has been deprecated, see my answer below.
    – drnextgis
    Commented Aug 14, 2012 at 15:20
1

OpenLayers.Util.onImageLoadError no longer exists

To replace a tile that couldn't be loaded with a static image, create a css selector for the .olImageLoadError class (e.g. a background-image):

.olImageLoadError {
    background: url(./images/missing-tile.png) no-repeat scroll 0 0 transparent !important;
    opacity: 1.0 !important;
}

For more complex tile loading error handling, register a listener to the layer's tileerror event.

Corresponding issues/pull requests:

onImageLoadError was removed by this commit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.