Wednesday 23 August 2017

GeoServer Web Feature Service (WFS) in OpenLayers problem


I am running GeoServer 2.1.1, and have a datastore from ArcSDE populated with features projected in EPSG:26918. I can successfully add a WMS to an OpenLayers map, but am having issues with WFS. I have the map set to EPSG:900913 in preparation for a mashup with Google base layers.


I am under the impression that vector layers are reprojected on the fly, and that absent of any user specification, features will be rendered using the default style.


Here is the main chunk of my script:


    map = new OpenLayers.Map('map', {
maxExtent: new OpenLayers.Bounds(

-128 * 156543.0339,
-128 * 156543.0339,
128 * 156543.0339,
128 * 156543.0339),
maxResolution: 156543.0039,
projection: "EPSG:900913",
units: "m"
});

var bridgeLayer = new OpenLayers.Layer.WMS(

"Bridge",
"http://localhost/geoserver/geodatabase/wms", {
layers: "geodatabase:Bridge",
format: "image/png",
transparent: true
},{
isBaseLayer: true
});

var wfsLayer = new OpenLayers.Layer.Vector(

"Photo Points", {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.WFS({
version: "1.0.0",
url: "http://localhost/geoserver/wfs",
featureType: "Photo Point",
srsName:"EPSG:26918",
featureNS: "http://dev.geodatabase.org",
geometryName: "SHAPE"
}),

visibility: true
});

map.addLayers([bridgeLayer, wfsLayer]);

And so, the WMS displays correctly (and when I add a Google base layer, it lines up correctly). However, the WFS layer fails to appear.


According to Firebug, however, my POST request is successful, and I receive an response. Furthermore, the layer object I defined looks to be a fully formed layer, although it does not appear to have any features in its "features" array. Not sure what that means. Screenshots appear below.


Something also that I don't understand, when I switch versions to "1.1.0", my POST request fails with a "NoApplicableCode" exception.


Additionally, I have tried reprojecting the data in GeoServer to spherical mercator EPSG:900918, and also redefining the srsName parameter, but both experiments have failed.






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