1

I hope someone can help me with this problem as I'm very confused!

I recently downloaded the IHO Sea Areas shape file from http://www.marineregions.org/downloads.php

One of my colleagues has uploaded the shape file to PostGIS and served it up using Geoserver. Because I want to display it over a google maps base layer in OpenLayers, we tried to set Geoserver to "Reproject Native to Declared" from EPSG:4326 (detected by Geoserver) to EPSG:3857 (Google projection). However, when trying to access the layer through Geoserver, I got a 404 The requested resource () is not available.

The only way that Geoserver would serve the file was if we set it to "Force Declared", at which point the WFS would return the data as requested.

So, I don't really understand why that's the case, but I got a WFS that seemed to work.

Next step (note: I have set up OpenLayers with a declared projection of EPSG:3857 on the map), I added the layer to OpenLayers using:

IHO = new OpenLayers.Layer.Vector("IHO Areas",{ 
            style: {
                    strokeColor: "green",
                    strokeWidth: 1,
                    fillColor: "green",
                    fillOpacity: "0.2",
                    cursor: "pointer"
                },
                projection: "EPSG:3857",
                strategies: [new OpenLayers.Strategy.Fixed()],
                protocol: new OpenLayers.Protocol.HTTP({
                    url: "http://*MyWebProxy*/IHO_Areas.php",
                    format: new OpenLayers.Format.GeoJSON()
                })
            }); 

    IHO.events.on({"loadend":function(){console.log(this);}});  
    map.addLayers([IHO]);

Now, the "loadend" event successfully fires, the logged IHO layer shows that it, and all its features, have been fetched successfully and the projection is logged as EPSG:3857 on the layer object, no errors are thrown by javascript/OpenLayers. But, nothing appears on the map.

This is especially weird as I copied and pasted the code from one of my earlier projects that worked perfectly using a different WFS vector layer source. So it seems there must be something weird about the IHO shape file or the data extracted from it, but I don't really know what to look for to fix it. Can anyone suggest anything to help?

Your Answer

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

Browse other questions tagged or ask your own question.