Hide Table of Contents
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.46/esri/css/esri.css">
  <style>
    html, body, #map {
      height: 100%;
      width: 100%;
      margin: 0;
      padding: 0;
    }
  </style>
  <script src="https://js.arcgis.com/3.46/"></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: "satellite",
        center: [138, 35],
        zoom: 7
      });

      var url = "https://dservices.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/services/JapanPrefectures2018/WFSServer";

      var opts = {
        "url": url,
        "version": "2.0.0",
        "name": "JapanPrefectures2018"
      };
      var layer = new WFSLayer();

      layer.fromJson(opts);

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

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