[GIS] How to add attributes to a Shapefile published in Geoserver

geoserveropenjumpqgisshapefile

I use Geoserver 2.4.4 with Shapefiles.
Now, I want to add attributes to features from a layer that already has some attributes. (Shown in Geoserver->Layers->Feature Type Details).

I add the attributes in QGIS (or Openjump) to the layer and store it in the shapefile. However, if I open it with Geoserver and click 'Reload feature type'. the added attributes do not show up. Strangely, when I view the features with WFS request=GetFeature, the attributes are displayed.

When I access the application with OpenLayers, finally, the attributes are missing.

Is there a way to detect within QGIS or OpenJump what might be the difference between the old attributes that are displayed and the new ones that are missing in OpenLayers and FeatureTypeDetails?

Best Answer

You try to edit the schema of already published shapefile layer and add new attributes into the schema. That is not supported from the admin utility and I cannot recommend any reasonable workaround either.

As written in http://docs.geoserver.org/stable/en/user/services/wfs/schemamapping.html, The GeoServer WFS supports a limited amount of schema output customization. However, support does not cover your case of adding new attributes into schema.

It is easiest to delete your existing layer and publish the layer again with the same name from your shapefile store. The shapefile will be analyzed again in this process and all the attributes, including the new ones you have added with OpenJUMP or QGIS, will be included in the schema.