3

I have a layer in geoserver and I want to get this layer with WMS in OpenLayers.

population = new OpenLayers.Layer.WMS("population",
    "http://localhost:8080/geoserver/world/wms", 
    {'layers': 'population', transparent: true, format: 'image/png'},
    {isBaseLayer: false}
);

I get the property of feature with OpenLayers.Control.WMSGetFeatureInfo.

featureInfo = new OpenLayers.Control.WMSGetFeatureInfo({
    queryVisible: true,
    layers: [population],
    output: 'features',
    infoFormat : 'application/vnd.ogc.gml',
    format: new OpenLayers.Format.GML,
    eventListeners: {
        getfeatureinfo: showInfo
    }
});

I want to edit the property of some features.

How can i do?

  • 1
    Hi Morteza! You have posted 5 questions in the previous 2 days about WFS and WFS editing. While there is no limit on the number of questions that you can post, I'll suggest that you do some research before posting new questions for every small issue. That way you'll get a better response, and better quality answers. – Devdatta Tengshe Aug 21 '14 at 6:59
  • Hi. Yes sir, in before 4 post I do some research but in this question I didn't. so sorry for this. – Morteza Malvandi Aug 21 '14 at 7:06
3

You can't edit the content of a WMS using OpenLayers. A WMS provides access to a data set (could be vector or raster data) as an image (through the GetMap request), and provides access to attribute properties for an image coordinate (through the GetFeatureInfo request). This information is read-only.

1

Adding to @nmtoken, WMS is read-only and can't edit the property of features. To edit you need WFS-T (Web Feature Service with Transaction) and Transaction must be enabled for that layer in GeoServer. Refer to this and this question for the syntax. this for adding nonspatial attributes.

Your Answer

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

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