More

GeoServer WMS correct WFS wrong coordinates for line features?


I'm calling my geoserver with WMS and later WFS to retrieve vector data (both times EPSG 4342. All features are correctly rendered in WMS and QGIS, so I'm sure the original data is fine. The original data is in a different projection.

When using WFS Points and Polygons are fine however the in the coordinates of Lines (in this case MultiLineStrings) some coordinates are wrong (no matter what target SRS I use) as follows.

For some reason every correct coordinate (5,52) is followed by three wrong pairs one with 3 coordinates. What am I doing wrong?

{"type":"MultiLineString","coordinates":[[[5.0608487764971075,52.692297776059995,0], [-174.5262361458704,-52.42339059959443,522794.14], [-174.5262361458704,-52.42339059959444,132879.64],[10.301634097169986,47.88557475819706,-1.7976931348623157E308], [5.060861697341368,52.69230660083358,0], [-174.5262361458704,-52.42339059959443,522794.78], [-174.5262361458704,-52.42339059959444,132880.08000000002],[10.3016358280441,47.88557468149963,-1.7976931348623157E308], [5.060869090038085,52.69230698062896,0], [-174.5262361458704,-52.42339059959443,522794.7], [-174.5262361458704,-52.42339059959444,132885.71],[10.301575780023164,47.88557734229453,-1.7976931348623157E308], [5.0609560834926945,52.692264261913294,0], [-174.5262361458704,-52.42339059959443,522789.95], [-174.5262361458704,-52.42339059959444,132886.26],[10.301571119976881,47.885577548785,-1.7976931348623157E308], [5.060960671963285,52.69226382517062,0], [-174.5262361458704,-52.42339059959443,522789.95], [-174.5262361458704,-52.42339059959444,132886.56],[10.301572051986144,47.88557750748696,-1.7976931348623157E308], [5.060964066474802,52.69226482306406,0], [-174.5262361458704,-52.42339059959443,522791.34], [-174.5262361458704,-52.42339059959444,132898.57],[10.301767374458528,47.8855688524167,-1.7976931348623157E308], [5.061217520122019,52.692452538110764,0], [-174.5262361458704,-52.42339059959443,522816.28]]] }

I call my server as follows https://server.example.com/geoserver/workspace/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=layer&maxFeatures=1&outputFormat=application%2Fjson&srsname=EPSG:4324

Is it possible that something in the data is wrong or my settings in GeoServer?

I have tried re-importing the data into the data base without success.


To answer my own question and hopefully help others.

The issue was that the source data contained 3d dimensions although it is a 2dimensional geometry. At this point in time I'm not sure why this is the case.

This older link

http://lists.osgeo.org/pipermail/postgis-users/2006-March/011508.html

suggests that it might have to do with how it was exported from an ESRI environment.

Consequently the geometry type is MULTILINESTRINGM and it turns out that the WFS component of geoserver can't handle that properly although WMS works fine.

The solution was to convert the data in Postgis to 2d using

Alter table my_geotable Alter Column geom TYPE geometry(MULTILINESTRING,*mySRID*) USING st_Force2d(geom)