I managed to partly resolve the mystery of GeoJSON returned by WFS service. There are still some coordinates missing, but that's probably consequence of some configuration error on GeoServer.
First I called WFS without srsName=epsg:4326 parameter and got the following result:
{ "type": "FeatureCollection", "totalFeatures": 439, "features": [ { "type": "Feature", "id": "vw_appia_cammino.fid-33ff99b0_186a32cb3fd_222b", "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 1232637.59780902, 4519475.4590854, 0 ], [ 0, 1232662.16392913, 4519487.27618627 ], [ 0, 0, 1232693.68416716 ], [ 4519502.58434888, 0, 0 ], [ 1232728.41700269, 4519517.51341278, 0 ], . . . "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::32632" } } }
There is obviously some error in coordinates returned. It seems like third coordinate is inserted and then coordinates are somehow shifted, and this cyclically repeats every four coordinates.
If coordinates are cleaned up and converted from EPSG::32632 to EPSG:4326 with proj4.js with this code:
road.features.forEach(function(feature) { var coords = feature.geometry.coordinates; coords.forEach(function(lineCoords, k) { var newLineCoords = []; var newCoord; for (var i = 0; i < lineCoords.length; i += 4) { newCoord = []; newCoord[0] = lineCoords[i][0]; newCoord[1] = lineCoords[i][1]; newLineCoords.push(newCoord); if ((i + 1) == lineCoords.length) break; newCoord = []; newCoord[0] = lineCoords[i + 1][1]; newCoord[1] = lineCoords[i + 1][2]; newLineCoords.push(newCoord); if ((i + 3) >= lineCoords.length) break; newCoord = []; newCoord[0] = lineCoords[i + 2][2]; newCoord[1] = lineCoords[i + 3][0]; newLineCoords.push(newCoord); } coords[k] = newLineCoords; }); }); var epsg32632 = new L.Proj.CRS('EPSG:32632','+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs +type=crs'); function coordsToLatLng(coords) { var latLng = epsg32632.unproject(L.point(coords[0], coords[1])); return latLng; }; L.geoJson(road, { coordsToLatLng: coordsToLatLng, style: function (feature) { return { stroke: true, color: "red", weight: 5}; } }).addTo(map);
then result seems OK, excepts for coordinates missing at the end of sections, which is probably consequence of mentioned coordinate shift:
