Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Open Layers I'm having a missing tile problem where it generates a missing link icon and a pink background. I found several threads including this one saying to add this code OpenLayers.Util.onImageLoadError = function() {this.src = '/img/blank.png';};

Sorry if this is dumb, but should my blank.png just be a 1px transparent png24? And also where should the img folder go?

Sorry, I've tried 1px, 256px, png24, png8, gif and putting the img folder and/or file in every conceivable place and I'm having no luck. Maybe you'll see something in these screenshots. Thanks for any help.

(PS. I've also tried an image with color to see if I can notice any actual change, so that's why the blank.png file looks red in the Finder thumbnail. Thanks again.)

chrome code file structure

share|improve this question
you don't need an image - it is just there to force the tile cache to get the 'real' images from Openlayers mobile - – Mapperz Jun 25 '12 at 17:23
I'm sorry, I'm new to Open Layers. Could you please paste how this code should read? OpenLayers.Util.onImageLoadError = function() {this.src = '/img/blank.png';}; – billted98 Jun 25 '12 at 18:45

Woohoo! Figured it out. This thread had the solution to change the CSS rather than the JS.

.olImageLoadError { 
    /* when OL encounters a 404, don't display the pink image */
    display: none !important;

This help article was helpful too, but I have not idea how to tell TileMill/MapBox to generate blank tiles rather than missing tiles. I'll get there someday.

share|improve this answer
TileMill will skip empty tiles; in map clients there's always a way to handle 404s somewhat gracefully and skipping tiles with no data is much more performant than rendering blank tiles everywhere. – tmcw Jun 26 '12 at 17:26
Agreed. Any ideas are most surely welcome :) I haven't been able to figure it out so far. – billted98 Jun 27 '12 at 14:16

Your Answer


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.