*I have a GeoServer installation on top of a PostGIS database. I am trying to set up a leaflet webmap (using Leaflet WFS-T plugin) so that I can insert, update and delete polygon features. I have managed to get this to work fine for Point features but something seems to be going wrong when inserting polygons.
Below is the request payload to GeoServer:* <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0"> <wfs:Insert><schememapper:geoserver-polygons xmlns:schememapper="schememapper"> <schememapper:geom><gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326" srsDimension="2"> <gml:exterior><gml:LinearRing srsDimension="2"><gml:posList>-1.3735914230346682 52.03958374014823 -1.9696426391601565 50.929466759820585 -3.7992525100708012 51.977294016543425 -1.3735914230346682 52.03958374014823</gml:posList> </gml:LinearRing></gml:exterior></gml:Polygon></schememapper:geom></schememapper:geoserver-polygons></wfs:Insert></wfs:Transaction> *And this is the response:* <?xml version="1.0" encoding="UTF-8"?><ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://35.242.177.142:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd"> <ows:Exception exceptionCode="InvalidParameterValue"> <ows:ExceptionText>Error performing insert: java.lang.String cannot be cast to org.locationtech.jts.geom.Geometry</ows:ExceptionText> </ows:Exception> </ows:ExceptionReport> *When I look at the geometry type in PostGIS it says it is MultiPolygon so I am conscious that the WFST request is only specifying 'polygon'. Below is my Leaflet code (I am using Leaflet draw to create the polygons):* var wfstPoly = new L.WFST({ url: 'http:localhost:8080/geoserver/ows', //typeNS is the workspace in geoserver typeNS: 'schememapper', typeName: 'geoserver-polygons', crs: L.CRS.EPSG4326, geometryField: 'geom', style: { color: 'blue', weight: 2 } }).addTo(map) .once('load', function () { // map.fitBounds(wfstPoly); }); // Drawing var drawControl = new L.Control.Draw({ draw:{circle:false, circlemarker:false, rectangle:false, }, edit:{featureGroup: wfstPoly } }); map.addControl(drawControl); map.on('draw:created', function (e) { var layer = e.layer; wfstPoly.addLayer(layer)}); map.on('draw:edited', function (e) { var layers = e.layers; layers.eachLayer( function (layer) { wfstPoly.editLayer(layer); }); }); // Save button L.easyButton('fa-save', function () { wfstPoly.save(); }, 'Save changes').addTo(map); -- Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html _______________________________________________ Geoserver-users mailing list Please make sure you read the following two resources before posting to this list: - Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/ - The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-users
