AnsweredAssumed Answered

How can I add wfs layer of geoserver on arcgis javascript map?

Question asked by bayram.ucuncu on Oct 4, 2020

Here is my sample geoserver wfs application in arcgis javascript api. it does not get the wfs features from server.  But gets GetCapabilities xml document. My code is like following.

 

require(["esri/map", "esri/InfoTemplate", "esri/layers/WFSLayer",
"esri/config", "dojo/domReady!"
], function(Map, InfoTemplate, WFSLayer, esriConfig) {
         map = new Map("map", {
                 basemap: "satellite",
                 center: [-80, 43],
                 zoom: 7
        });

 

        esriConfig.defaults.io.corsEnabledServers.push("ahocevar.com")

        var opts = {
                 "url": "https://ahocevar.com/geoserver/wfs",
                 "version": "1.1.0",
                "name": "osm:water_areas",
               "wkid": 4326
        };
         var layer = new WFSLayer();

         layer.fromJson(opts);

         map.addLayer(layer);
});

Outcomes