My Target: Using Openlayers + geoserver + POSTGIS,
- Display a google map.
- Dsplay layers from geoserver to the user in a browser ,
- Allow user to edit features for a layer,
- Persist the features added newly by the end user to the POSTGIS database
My Status :
- I could display google map.
- Loaded SHAPEFILES(.shp) to the POSTGIS DB using postgis shapefile import/export manager
- Added a workspace in GEOSERVER ADMIN CONSOLE.
- Added a DATASOURCE in GEOSERVER ADMIN CONSOLE.
MyProblem :
- unable to display the layer in browser.
- Unable to find TYPE GEOMETRY under “Feature Type Details” in EDIT LAYER SCREEN.
REFERENCES:
WFS code in a simple HTML page :
var wfs = new OpenLayers.Layer.Vector("USACITIES",
{
strategies: [new OpenLayers.Strategy.Fixed()],
projection: new OpenLayers.Projection("EPSG:4326"),
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
url: "http://localhost:8080/geoserver/wfs",
featurePrefix: 'usa', //geoserver worspace name
featureType: "usa:states", //geoserver Layer Name
featureNS: "http://usa.opengeo.org", // Edit Workspace Namespace URI
geometryName: "the_geom" // field in Feature Type details with type "Geometry"
})
});
map.addLayer(wfs);
I think there is a mistake in your code:
I think this should be
because the prefix is already defined with the featureNS
As for the “Feature Type Details” in Geoserver:
Check in Postgres if your table has “the_geom” or “geom” coloumn and if its type is geometry.