2

I have a WMS layer that i'm using to display complex features to the users. It was really the main reason i chose GeoServer, because rendering all the vectors, made it painfully slow. Like GeoServer converts all features to raster tiles things got much faster.

This works fine to visualize the information and i even draw a vector over the selected shape, using the features geometry attributes to highlight it like so:

enter image description here

But I want also to have an edit mode to change the attributes. Like this:

enter image description here

I searched other discussions and everybody is talking about WFS-T to change vectors, and it seems to me a bit strange to limit the editing of features only to vectors.

If one can identify the feature even if it's raster using WMSGetFeatureInfo to create the popup is it so difficult to change its attributes?

I have the id of the selected feature so can one connect and update directly the POSTGIS table? Is this possible?

Update table where id = etc etc ?

What kind of approach do you recommend?

5

This is not possible with WMS. WFS gives the data itself (READ only), and WFS-T is a transactional extension of WFS that allows you to CREATE/UPDATE/DELETE data through the WFS protocol. In your case, for what you need, you can't use WMS / GetFeatureInfo but you need WFS-T or to use a different approach like JDBC to edit the content of your postgis tables.

| improve this answer | |
  • "Image representation" is not quite accurate. As Miguel states, GetFeatureInfo can return GML which is vector data and server may also support for example KML format for GetMaps which is all vectors. However, WMS is not planned to be transactional and it just can't be used for editing features. – user30184 Sep 30 '14 at 10:11
  • And is a JDBC connection to POSTGIS possible and a viable alternative to update attributes by feature ID? – Miguel Ângelo Belém Sep 30 '14 at 10:21
  • @user30184 you're right indeed i've corrected my answer. By the way, this lack of terminology accuracy you point out seems to reach the OGC WMS specification itself (see opengeospatial.org/standards/wms), which unfortunately also refers to "images". Anyway, the matter here is about protocols and the fact WMS cannot be used to edit features. – eblondel Sep 30 '14 at 10:27
  • 5
    @MiguelÂngeloBelém Your are not obliged to go through WFS-T. I would say it's the way to go if you are going to edit the geometries. But in your case, as you only need to edit attributes, yes you can develop a system to interact with your database using JDBC, without passing by WFS-T. – eblondel Sep 30 '14 at 10:33
  • 1
    I see your point. By using WMS GetFeatureInfo, you should inherit all attributes + the featureId. If you didn't specify to use the postgis table primary key as FeatureId in geoserver, the field that you use as primary key should anyway be available as attribute (implicit feature identifier). You can sure use it to identify the feature to edit through WFS-T. – eblondel Sep 30 '14 at 13:37
0

I want to give feedback on my project evolution and how i solved my problem of editing WMS features, both attributes and geometry.

Using WMSGetFeatureInfo and asking for information in JSON format i can store all the atributtes in a object. Using a form in the popup I then edit the values and send them to a JSP page that i created inside Geoserver webapps folder by POST method. The JSP page connects to the POSTGIS database by JDBC and updates the attributes by feature id.

For the geometry i make a query to geoserver, asking for the geometry data of a specific feature by id, again in JSON format. I didn't use the geometry provided by WMSGetFeatureInfo function because its detail depends on the zoom level and a specific geometry query comes in full detail. With that geometry data that i get i then create a new vector feature overlapping the same raster feature serving also as a highlight. That vector feature can then be modified with the ModifyFeature Control. Then send the geometry in WKT format to a JSP page that updates the geometry collumn in POSTGIS. Some paramaters have to be changed in the JETTY config to alow large POST data to be send.

The update geometry command in the JSP page is something like this...

String queryString = "UPDATE geral SET geom = ST_GeometryFromText('" + GEOMETRY + "', 4326) WHERE gid = " + ID_VALUE;

Hope it helps someone.

| improve this answer | |

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.