Hide Table of Contents
Latest Samples
View WFS Layer sample in sandbox
WFS Layer

Description

This sample demonstrates how to work with WFS layers in a web map.

Code

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
  <title>WFS Layer</title>
  <link rel="stylesheet" href="https://js.arcgis.com/3.26/esri/css/esri.css">
  <style>
    html, body, #map {
      height: 100%;
      width: 100%;
      margin: 0;
      padding: 0;
    }
  </style>
  <script src="https://js.arcgis.com/3.26/"></script>
  <script>
    var map;

    require(["esri/map", "esri/InfoTemplate", "esri/layers/WFSLayer",
      "esri/config", "dojo/domReady!"
    ], function(Map, InfoTemplate, WFSLayer, esriConfig) {
      map = new Map("map", {
        basemap: "gray",
        center: [16.4, 48.2],
        zoom: 11
      });

      esriConfig.defaults.io.proxyUrl = "/proxy/";

      var url = "https://data.wien.gv.at/daten/geo";

      var opts = {
        "url": url,
        "version": "2.0.0",
        "name": "BEZIRKSGRENZEOGD",
        "wkid": 4326,
        "maxFeatures": 1000
      };
      var layer = new WFSLayer();

      layer.fromJson(opts);

      map.addLayer(layer);
    });    
  </script>
</head>

<body>
  <div id="map"></div>
</body>
</html>
 
          
Show Modal