Skip to content

Instantly share code, notes, and snippets.

@hhkaos
Created June 29, 2022 14:54
Show Gist options
  • Select an option

  • Save hhkaos/d9334badf80a9848981b1f21687034e4 to your computer and use it in GitHub Desktop.

Select an option

Save hhkaos/d9334badf80a9848981b1f21687034e4 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>ArcGIS REST JS</title>
<style>
body {
font-family: monospace;
color: white;
}
pre {
overflow: auto;
padding: 1rem;
}
body,
pre {
background: #000000;
}
</style>
</head>
<body>
<pre id="result"></pre>
<script src="https://unpkg.com/@esri/[email protected]/dist/bundled/request.umd.js"></script>
<script src="https://unpkg.com/@esri/[email protected]/dist/bundled/feature-service.umd.js"></script>
<script>
const apiKey = "YOUR_API_KEY";
const authentication = arcgisRest.ApiKeyManager.fromKey(apiKey);
const queryGeometry = {
x: -118.807,
y: 34.002,
spatialReference: {
wkid: 4326
}
};
arcgisRest
.queryFeatures({
url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/LA_County_Parcels/FeatureServer/0",
geometry: queryGeometry,
geometryType: "esriGeometryPoint",
spatialRel: "esriSpatialRelIntersects",
authentication
})
.then((response) => {
console.log(response.features);
document.getElementById("result").textContent = JSON.stringify(response.features, null, 2);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment