I have a service with about thousand points. I wish to enable the user to edit the attributes of the features.
Since there are so many points, I don't want to display them as a vector layer (using WFS Protocol) on the map. I am using a WMS layer to display it on the map.
Using a WMSGetFeatureInfo control, I am getting the attributes of a selected point and showing them in a form to the user.
How can I now save the edited attributes to the database? Is there some other way of achieving it?
Best Answer
One possible workaround could be to pull only the selected point as a feature in an additional layer. For instance, after the user selected a point in the WMS throuhgh the WMSGetFeatureInfo control, add a WFS-T layer that only contains the selected point, and remove it again after editing it. Then you only need o display one point at a time in a vector layer.
You can instantiate the map with a Vector layer, which has a filter, like this:
Include the following function to update the filter:
You can change the subset, by calling the SetFilter function, with particular customerid, like this:
If your data is stored in a database (such as PostGIS), you could also consider writing a PHP script that updates the feature attribute table based on the feature ID you get from the WMSGetFeatureInfo request.