Tuesday 26 May 2015

openlayers 2 - OpenStreetMap tiles not loaded despite being received


While using OpenLayers to load OpenStreetMap, I observe that part of the map would sometimes be covered with blank pink tiles. I searched and found similar complaints with solutions suggesting the modification of OpenLayers.IMAGE_RELOAD_ATTEMPTS parameter to an integer number greater than 0. I did exactly that, but it doesn't solve the problem.


Using Firebug, I am able to verify that the tiles were indeed downloaded successfully. However, for some unknown reason, they just do not load onto the map. I have no issue with Google Maps as a base layer. The problem seems to be restricted to OpenStreetMap only. Any idea how to solve this pink tile of death?


OpenStreetMap with pink tiles



Answer



I find that this problem is particular to Firefox 12.0 browser. Google Chrome 21.0 seems unaffected. And only OpenStreetMap is affected, its sister site OpenCycleMap is not. The solution is to set crossOriginKeyword in tileOptions of OSM layer to null:


tileOptions: {crossOriginKeyword: null}

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...