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

382
0
10-04-2020 03:39 AM
BayramÜçüncü1
New Contributor

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);
});

0 Kudos
0 Replies