JSFiddle - React, Tailwind, and code Playground
by Alex Azuero
HTML
<!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>StandardGeographyQueryTask</title>
<link rel="stylesheet" href="//js.arcgis.com/3.16/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="//js.arcgis.com/3.16/esri/css/esri.css">
<style>
html,
body,
#map {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body class="claro">
<script src="//js.arcgis.com/3.16"></script>
<script>
var map, layer;
require([
"dojo/_base/array",
"dojo/store/Memory",
"dijit/form/FilteringSelect",
"esri/map",
"esri/Color",
"esri/graphicsUtils",
"esri/urlUtils",
"esri/layers/FeatureLayer",
"esri/tasks/geoenrichment/GeographyQuery",
"esri/tasks/geoenrichment/SubGeographyQuery",
"esri/tasks/geoenrichment/StandardGeographyQueryTask",
"dojo/domReady!"
], function (
array,
Memory,
FilteringSelect,
Map,
Color,
graphicsUtils,
urlUtils,
FeatureLayer,
GeographyQuery,
SubGeographyQuery,
StandardGeographyQueryTask
) {
// valid credentials needed to access the geoenrichment service from ArcGIS Online
urlUtils.addProxyRule({
proxyUrl: "/sproxy/",
urlPrefix: "geoenrich.arcgis.com"
});
var standardGeographyQueryTask = new StandardGeographyQueryTask();
function executeStandardGeographyTask(queryItem) {
if (layer) {
map.removeLayer(layer);
}
return standardGeographyQueryTask.execute(queryItem.query).then(function (result) {
var fs = result.featureSet;
if (fs.features.length > 0) {
...