Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to get the list of feature layers on GeoServer and then user can add layers into map at anytime they want. my question is: when using OpenLayers.Protocol.WFS loading a layer, is "geometryName" required?

since from the response of "WFSGetCapabilities" request to Geoserver, for each featureType, there are only "name, title, srsName, and featureNS". If “geometryName” is required, I have to retrive this from "DescribeFeatureType" request by enumerating the feature's properties . however, these two requests are asynchronous, I am not sure how to load this layer without user's interaction input.

anybody helps? appreciated!!

share|improve this question

Even better you might not have to retrieve it at all, but it depends very much on the OpenLayers version.

2.10: geometryName is not required. If a value is not provided it will default to 'the_geom' which might not work for you, but that also depends on the WFS version you are using. If using geoserver as a backend I would try the default.

2.11 (currently in dev): no more required and (here's the great news) for WFS versions > 1 OL should figure it out by itself as per the documentation on the OL WFS proto:

share|improve this answer

I suppose you can do a nested async call. The outer one would be a DescribeFeatureType and the inner one would be the OpenLayers.Protocol.WFS call.

Something like (not tested):

var request = OpenLayers.Request.GET({
    url: 'http://myGeoserver:8080/geoserver/wfs?service=wfs&version=1.1.0&request=DescribeFeatureType',
    success: function (response) {

        var myGeometryName = parseResponseForgeometryName(response);

        var protocol = new OpenLayers.Protocol.WFS({
            version: "1.1.0",
            EndPointURL: "http://myGeoserver:8080/geoserver/wfs",
            featurePrefix: "catalog", //worspace 
            featureType: "myLayer", // Layer Name
            featureNS: "", // Edit Workspace Namespace URI
            geometryName: myGeometryName,
            srsName: myProjections.Mercator

        var response ={
            maxFeatures: 500,
            callback: function () {

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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