If you use WFS 1.0.0 the srsName
parameter is not supported, so you can’t use OpenLayers to decide in which projection you want your features returned. Therefore you'll need 1.1.0
Also you need to request the WFS in the same SRS as your basemap otherwise no features will appear as they will be outside the map's bounding box. So the srsName should be set to EPSG:900913 (not EPSG:900918 as in your question - a typo maybe?).
Finally you need to make sure that Geoserver can reproject the WFS into EPSG:900913. You can check this by issuing a request similar to:
http://localhost/geoserver/wfs?service=WFS&request=GetCapabilities&version=1.1.0
I had similar issues with MapServer rather than GeoServer, but the same principles probably apply:
http://geographika.co.uk/mapserver-openlayers-and-the-wfs-maze
You can reproject features on the client side, but this may take longer than doing it on the server. You will also need to include the Proj4JS library in your web application and the EPSG:26918 definition in your code to take this approach. You'll also need to set the layers's projection:
Proj4js.defs["EPSG:26918"] = "+proj=utm +zone=18 +ellps=GRS80 +datum=NAD83 +units=m +no_defs";
var myproj =new OpenLayers.Projection("EPSG:26918");
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,
projection: myproj
});
Have a look at the source in this example - http://openlayers.org/dev/examples/wfs-reprojection.html for more details.
Also you may want to change the strategy to BBox or you will load all the features in in one go.
strategies: [new OpenLayers.Strategy.BBOX()]
Best Answer
Custom Control
Hold
Shift
button to create the rectanglehttp://openlayers.org/dev/examples/custom-control.html
You will get the bound box lat/lng response.
You can use this response to retrieve features.
Dynamic POIs via a Text Layer
In this example the data you see is retrieved from a text file but could be from a geojson,kml or database/api or geoserver
http://openlayers.org/dev/examples/dynamic-text-layer.html
Get WFS from Geoserver (Web Feature Service)
This get the WFS service from Geoserver and displays in Openlayers
http://openlayers.org/dev/examples/getfeature-wfs.html
use the
Shift
key to add features to the selection,You will want to combine the entire set of examples to do your 'select user defined polygon' map.