[GIS] How to get feature id for particular feature after feature ismodify in OpenLayers

openlayers-2

I am using modify control in OpenLayers 2.12. After feature is modified I am running the function below:

building.events.register('afterfeaturemodified',building, onchanges);

Where building is my WFS layer. Now in "onchanges" function runs and now I want my WFS feature id/name, etc.

My function is as follows:

function onchanges(ev)
        {
            var polygonch=ev.feature.geometry;
        }

Now in this function I want feature id/name on which modification is done. Or other method to get feature info on which editing/modification is done.

Best Answer

You just need to call for the feature id, the same way you would for the feature geometry:

 changed_polygon_id = ev.feature.id;