1

I have a leaflet application and I want to display some WFS layers coming from Geoserver.

In Geoserver, I declare my layer with a "native SRC" EPSG:2154, and with a "declared SRC" EPSG:4326 and set "SRS handling" to "Reproject native to declared" to display it in leaflet.

Now, if I try to display the wfs with leaflet, it renders something weird. I have the first point of the line at the right coordinates, but then, lines are going to wrong coordinates, thousands kilometers away from they should be.

Here is a part of the jsonp :

parseResponse({"type":"FeatureCollection","totalFeatures":1079,"features":[{"type":"Feature","id":"conduites_eu_l93.1","geometry":{"type":"MultiLineString","coordinates":[[[1.5613439688423163,49.03869313600971,0],[-1.5777641664737554,-2.180153996047118,6883035.044373245]]]},"geometry_name":"geom","properties":{"code_insee":78057,"diametre":200,"type":"IND","longueur_m":67.88,"bbox":[-1.5777641664737554,-2.180153996047118,1.5613439688423163,49.03869313600971]}},{"type":"Feature","id":"conduites_eu_l93.2","geometry":{"type":"MultiLineString","coordinates":[[[1.5614998405017906,49.039338391376226,0],[-1.5777936149688272,-2.1796435609058618,6883111.061549901]]]}

As you can see, the first coordinates are rights, but the second point is wrong.

Is there a problem reprojecting with geoserver ? I tried not to reproject, but I still have the same problem with other wrong coordinates.

1

In GeoServer you should leave the data in the native projection (except in very specialised situations) and then GeoServer will manage the reprojection to whatever projection you make the WFS request in, normally this should be the map projection unless you for some reason want to handle the reprojection in the browser.

  • Many thanks iant ! I've finally fixed the problem thanks to that post link. I don't know why but my geom field in postgis was in "MultiLineStringZM" instead of "MultiLineString" ... – Hippipers Dec 14 '15 at 10:00

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.