Spatial analysis is the process of using analytical techniques to find relationships, discover patterns, and solve problems with geographic data.
You can use thearcgis-rest-request package to make a job request to the spatial analysis service.
Steps
- Import your data from a CSV, XLS, GeoJSON, or Shapefile file to create a feature service and feature layer.
- Get your ArcGIS portal's analysis URL.
- Install and reference the
arcgis-rest-requestpackage. - Perform a spatial analysis operation.
Feature analysis
You can use feature analysis to find where features overlap, measure their size and shape, or detect patterns and relationships in your data.
Perform a feature analysis
Learn how to perform a hot spot analysis on parking violations data using the Job request in ArcGIS REST JS.
async function runHotSpotAnalysis(session) {
const portalSelf = await getSelf({ authentication: session });
const analysisUrl = portalSelf.helperServices.analysis.url;
const params = {
analysisLayer: {
url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/sf_traffic_parking_violations_sa_osapi/FeatureServer/0"
},
shapeType: "Hexagon",
outputName: {
serviceProperties: {
name: `RestJS_find_hot_spots_${Date.now()}`
}
}
};
const jobReq = await Job.submitJob({
url: `${analysisUrl}/FindHotSpots/submitJob`,
params,
authentication: session
});
jobReq.on(JOB_STATUSES.Status, (info) => {
console.log("Job Status:", info.status);
});
const jobResults = await jobReq.getAllResults();
return jobResults;
}