I'm having a problem with the pink tiles when trying to display a map. I'm using Geoserver 2.6. In the main html page, I reference to Openlayers with:

<script src="openlayers/lib/OpenLayers.js"></script>

This is how I define my layer:

new OpenLayers.Layer.WMS("dim_province",
                    "http://localhost:8080/geoserver/wms", {
                        layers: "dw1:dim_province",
                        transparent: true,
                        format: "image/gif"
                    }, {
                        isBaseLayer: false,
                        buffer: 0,
                        visibility: false

The layer is displayed with no problem on Geoserver>preview as OpenLayers, however It shows a pink tile image when I'm running the html page.

  • 1
    Try using a tool like Fiddler to examine the request to and response from Geoserver. That way you'll be able to see if the server is getting the correct parameters sent to it and if it's throwing an exception. – drunkenwagoner May 12 '15 at 23:30

Some fairly obvious things to check:

1) try replacing "localhost" with your IP address, especially if you are running your webmap off of another machine (e.g. Geoserver on guest, webmap on host);

2) verify read/write permissions for the folder containing the dataset;

3) Check the code of the openlayers preview and compare to your code. Likewise, note that Geoserver previews use OL2, not OL3;

4) Your code should look like this for your layer in OL3:

var lyr_layerName = new ol.layer.Tile({
     source: new ol.source.TileWMS(({
     url: "http://X.X.X.X:8080/geoserver/ows?version%3D1.3.0%26",
     params: {"LAYERS": "LayerName", "TILED": "true"},
     title: "LayerName"

5) If you're really having trouble, try using the "Export to OpenLayers" QGIS plugin. Available here, but easily downloadable via QGIS plugin installer

  • OP asked to do this in OL2. – Gabor Farkas May 12 '15 at 18:19
  • 1
    Aside: Export to Openlayers 3 is now qgis2web, which can also export to a Leaflet webmap. – Tom Chadwin Oct 16 '15 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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