Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

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...

share|improve this answer
    
Shows a new error Failed to load resource: the server responded with a status of 404 (Not Found). –  bios Aug 14 '12 at 11:02
    
check your all paths whether they are valid or invalid. –  Aragon Aug 14 '12 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 Aug 14 '12 at 11:20
    
@Aragon, onImageLoadError has been deprecated, see my answer below. –  drnextgis Aug 14 '12 at 15:20

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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