I installed PostgreSQL and PostGIS and created PostGIS layers in GeoServer. But when i want to change geometry in QGIS via WFS it drops an error:

": Error performing insert: java.lang.String cannot be cast to com.vividsolutions.jts.geom.Geometry"

I've read the type of the geometry isn't OK, eg. 'linestring' and 'multilinestring' How could i solve this problem to update my layers?

  • please edit your question to show us your table design – Ian Turton May 5 '16 at 14:56
  • It is a bug in QGIS and developers are working on it. QGIS tries to insert a linestring even the schema describes that geometry must be a multilinestring. – user30184 May 5 '16 at 16:12
  • @user30184 would you post that as an answer and include a link to the ticket? thanks – underdark May 5 '16 at 17:57
  • @user30184 Good news! Hope they can solve this problem soon! So the geometry type causes this bug. – Hadh May 6 '16 at 7:43

The reason for the error is most probably that the geometry type of the WFS feature type is defined to be MultiLinestring or MultiPolygon, but QGIS it trying to insert simple Linestring or Polygon. You can check the WFS geometry type by making a DescribeFeatureType request. For example http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.0.0&request=describefeaturetype&typename=topp:states is announcing the geometry type as

xsd:element maxOccurs="1" minOccurs="0" name="the_geom" nillable="true" type="gml:MultiPolygonPropertyType"

Corresponding QGIS issue is https://hub.qgis.org/issues/14139 and it seems to be fixed on March 30, 2016 with commit https://github.com/qgis/QGIS/commit/768416340fdf233f8f5ce8945636d8df8b2e4f48. Duplicate issue https://hub.qgis.org/issues/14409 may give some more background.

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.