1

I'm quite new to Leaflet, and i would like to use this WFS, https://wxs.ign.fr/agriculture/geoportail/wfs?SERVICE=WFS&REQUEST=GetCapabilities, to display interactive agricultural plots on a leaflet map.

I tried this:

var data_url ="https://wxs.ign.fr/agriculture/geoportail/wfs?SERVICE=WFS&REQUEST=GetFeature";
    var params = '&Name=RPG.2020:parcelles_graphiques&outputFormat=application/json';
    var url =encodeURI(data_url+params) ;
    $.get(url, function(json){
        var obj = $.parseJSON(json);
        console.log(obj);
    });

it returns this in the console :

<ExceptionReport>
<script> try { Object.defineProperty(navigator, "globalPrivacyControl", { value: false, configurable: false, writable: false }); document.currentScript.parentElement.removeChild(document.currentScript); } catch(e) {}; </script>
<Exception exceptionCode="MissingParameter">Resource parameter not found</Exception>
</ExceptionReport>
0
1

Your request is missing a version number, also for WFS 2 you need a typenames parameter, and for previous versions a typename with your GetFeature request.

The below request works for example:

https://wxs.ign.fr/agriculture/geoportail/wfs?SERVICE=WFS&REQUEST=GetFeature&typeNames=RPG.2020:parcelles_graphiques&outputFormat=application/json&version=2.0.0&count=1

Gives:

{"type":"FeatureCollection","features":[{"type":"Feature","id":"parcelles_graphiques.153165","geometry":{"type":"MultiPolygon","coordinates":[[[[2.49695832,47.13359959],[2.49911964,47.13497217],[2.50232895,47.1327338],[2.50048126,47.13167228],[2.49977537,47.13126967],[2.49916414,47.13091249],[2.49916414,47.13091249],[2.4991522,47.13090728],[2.49915218,47.13090728],[2.49613253,47.13270356],[2.49613253,47.13270357],[2.49648898,47.13295623],[2.49648898,47.13295623],[2.49688997,47.13318903],[2.49688998,47.13318903],[2.49688997,47.13318904],[2.49684257,47.13322098],[2.49684257,47.13322099],[2.49716883,47.13341892],[2.49716883,47.13341893],[2.49716883,47.13341893],[2.49695832,47.13359959]]]]},"geometry_name":"the_geom","properties":{"id_parcel":"9712268","surf_parc":10.8,"code_cultu":"LUZ","code_group":"16","culture_d1":"","culture_d2":"","bbox":[2.49613253,47.13090728,2.50232895,47.13497217]}}],"totalFeatures":9841300,"numberMatched":9841300,"numberReturned":1,"timeStamp":"2022-01-10T12:35:50.779Z","crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:EPSG::4326"}},"bbox":[47.13090728,2.49613253,47.13497217,2.50232895]}

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.