arcgis-map-tools
Skill1 starsChanged 6 months agoMITView on GitHub
Add interactive map tools with the ArcGIS Maps SDK for JavaScript 5.1 Map Components: arcgis-sketch for drawing, arcgis-measurement and its 2D/3D variants for measuring (or measurement analyses in code), and arcgis-snapping-controls, which must share the sketch's snappingOptions to have any effect. Use this skill whenever the user adds drawing, measuring, or snapping tools to a map or scene.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- GeoDaoyu/arcgis-maps-sdk-js-ai-contexttheir own version, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- GeoDaoyu/arcgis-maps-sdk-js-ai-context★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository73 other files it gives its agents.
- skills/arcgis-3d-layers/AGENTS.mdAGENTS.md
- skills/arcgis-advanced-layers/AGENTS.mdAGENTS.md
- skills/arcgis-ai-components/AGENTS.mdAGENTS.md
- skills/arcgis-arcade/AGENTS.mdAGENTS.md
- skills/arcgis-authentication/AGENTS.mdAGENTS.md
- skills/arcgis-charts/AGENTS.mdAGENTS.md
- skills/arcgis-cim-symbols/AGENTS.mdAGENTS.md
- skills/arcgis-coding-components/AGENTS.mdAGENTS.md
- skills/arcgis-coordinates-projection/AGENTS.mdAGENTS.md
- skills/arcgis-core-maps/AGENTS.mdAGENTS.md
- skills/arcgis-core-utilities/AGENTS.mdAGENTS.md
- skills/arcgis-custom-rendering/AGENTS.mdAGENTS.md
- skills/arcgis-editing/AGENTS.mdAGENTS.md
- skills/arcgis-embeddable-maps/AGENTS.mdAGENTS.md
- skills/arcgis-feature-effects/AGENTS.mdAGENTS.md
- skills/arcgis-geometry-operations/AGENTS.mdAGENTS.md
- skills/arcgis-imagery/AGENTS.mdAGENTS.md
- skills/arcgis-interaction/AGENTS.mdAGENTS.md
- skills/arcgis-knowledge-graphs/AGENTS.mdAGENTS.md
- skills/arcgis-layers/AGENTS.mdAGENTS.md
- skills/arcgis-map-tools/AGENTS.mdAGENTS.md
- skills/arcgis-parquet/AGENTS.mdAGENTS.md
- skills/arcgis-performance/AGENTS.mdAGENTS.md
- skills/arcgis-popup-templates/AGENTS.mdAGENTS.md
- skills/arcgis-portal-content/AGENTS.mdAGENTS.md
- skills/arcgis-rest-services/AGENTS.mdAGENTS.md
- skills/arcgis-scene-environment/AGENTS.mdAGENTS.md
- skills/arcgis-smart-mapping/AGENTS.mdAGENTS.md
- skills/arcgis-spatial-analysis/AGENTS.mdAGENTS.md
- skills/arcgis-starter-app/AGENTS.mdAGENTS.md
- skills/arcgis-tables-forms/AGENTS.mdAGENTS.md
- skills/arcgis-time-animation/AGENTS.mdAGENTS.md
- skills/arcgis-utility-networks/AGENTS.mdAGENTS.md
- skills/arcgis-visualization/AGENTS.mdAGENTS.md
- skills/arcgis-widgets-advanced/AGENTS.mdAGENTS.md
- skills/arcgis-widgets-ui/AGENTS.mdAGENTS.md
- skills/hello-world/AGENTS.mdAGENTS.md
- arcgis-3d-layersSkill
- arcgis-advanced-layersSkill
- arcgis-ai-componentsSkill
- arcgis-arcadeSkill
- arcgis-authenticationSkill
- arcgis-chartsSkill
- arcgis-cim-symbolsSkill
- arcgis-coding-componentsSkill
- arcgis-coordinates-projectionSkill
- arcgis-core-mapsSkill
- arcgis-core-utilitiesSkill
- arcgis-custom-renderingSkill
- arcgis-editingSkill
- arcgis-embeddable-mapsSkill
- arcgis-feature-effectsSkill
- arcgis-geometry-operationsSkill
- arcgis-imagerySkill
- arcgis-interactionSkill
- arcgis-knowledge-graphsSkill
- arcgis-layersSkill
- arcgis-parquetSkill
- arcgis-performanceSkill
- arcgis-popup-templatesSkill
- The first 60 shown.
The file
Files
Map Tools
When to use: Activate this skill whenever the user adds drawing, measurement, or snapping tools to a map or scene.
Overview
These components give users ready-made sketching, measuring, and snapping.
- Problem it solves: standard drawing and measuring UX without writing the interaction yourself.
- Who it serves: developers adding interactive tools to a map app.
- Pattern it teaches: nest the component in the map, wire the pieces that do not wire themselves, read results.
- What it does NOT cover: programmatic drawing and hit tests (see
arcgis-interaction) or persistence (arcgis-editing).
Quick Start
<arcgis-map basemap="osm" center="-74.08,4.6" zoom="12">
<arcgis-sketch slot="top-right"></arcgis-sketch>
<arcgis-snapping-controls slot="bottom-right"></arcgis-snapping-controls>
<arcgis-distance-measurement-2d slot="top-left"></arcgis-distance-measurement-2d>
</arcgis-map>import "@arcgis/map-components/components/arcgis-sketch";
import "@arcgis/map-components/components/arcgis-snapping-controls";
import "@arcgis/map-components/components/arcgis-distance-measurement-2d";
const sketch = document.querySelector("arcgis-sketch")!;
const snapping = document.querySelector("arcgis-snapping-controls")!;
await sketch.componentOnReady();
snapping.snappingOptions = sketch.snappingOptions; // they do NOT share it on their ownDecision Tree
- Draw/edit geometry interactively?
- Yes →
arcgis-sketch(it creates a "Sketch Layer"GraphicsLayerand adds it to the map).
- Yes →
- Measure?
- 2D map →
arcgis-distance-measurement-2d/arcgis-area-measurement-2d, orarcgis-measurementwithactiveTool"distance"|"area". - 3D scene →
arcgis-direct-line-measurement-3d/arcgis-area-measurement-3d, orarcgis-measurementwith"direct-line"|"area". - A value in code, no UI →
DistanceMeasurementAnalysis/AreaMeasurementAnalysisinview.analyses.
- 2D map →
- Snap while drawing?
- Yes → share one
SnappingOptionsbetween sketch andarcgis-snapping-controls, and addfeatureSources.
- Yes → share one
Default: arcgis-sketch for drawing, the 2D/3D measurement component that matches the view.
Import Patterns
Direct ESM (recommended for npm/Vite/Webpack)
import DistanceMeasurementAnalysis from "@arcgis/core/analysis/DistanceMeasurementAnalysis.js";
import FeatureSnappingLayerSource from "@arcgis/core/views/interactive/snapping/FeatureSnappingLayerSource.js";Dynamic Imports (CDN)
const DistanceMeasurementAnalysis = await $arcgis.import("@arcgis/core/analysis/DistanceMeasurementAnalysis.js");Map Components (recommended for new projects)
import "@arcgis/map-components/components/arcgis-measurement";
import "@arcgis/map-components/components/arcgis-snapping-controls";Key Concepts
Concept 1: Sketch component
arcgis-sketch gives a toolbar to draw and edit. Measured with 5.1.27: it adds its own GraphicsLayer titled
"Sketch Layer" to the map (listMode: "show", so it appears in a layer list). Shapes live only in that layer; read
them from arcgisCreate / arcgisUpdate and persist them yourself.
Concept 2: Measurement components and analyses
The 2D components (arcgis-distance-measurement-2d, arcgis-area-measurement-2d) start in state: "ready" with
unit: "metric" (a system: it switches m/km by size). arcgis-measurement starts with activeTool: null and
state: "disabled" until you pick a tool; clear() returns it there. In code, a measurement is an analysis:
measured, a DistanceMeasurementAnalysis with a 0.05° line at 4.6°N gave 5.5 km (geodesic), and a
0.01° × 0.01° square gave 1 227 040 m² with a 4 km perimeter, read from (await view.whenAnalysisView(a)).result.
Concept 3: Snapping is configuration, shared by reference
Each component has its own snappingOptions. Measured: with arcgis-sketch and arcgis-snapping-controls in
the same map, the two objects were different, and turning snapping on in the controls left the sketch's
enabled: false. Defaults on the sketch: enabled: false, selfEnabled: true, featureEnabled: true,
distance: 5 px, 0 featureSources, gridEnabled: false.
Common Pitfalls (Top 3)
Pitfall 1: Expecting snapping controls to drive the sketch
<!-- ❌ Anti-pattern: two separate SnappingOptions -->
<arcgis-sketch></arcgis-sketch>
<arcgis-snapping-controls></arcgis-snapping-controls>// ✅ Correct
snapping.snappingOptions = sketch.snappingOptions;
sketch.snappingOptions.featureSources.add(new FeatureSnappingLayerSource({ layer: parcels, enabled: true }));Impact: measured: the user toggles snapping on and the sketch still reports enabled: false. Nothing snaps,
and no error.
Pitfall 2: A 3D measurement component on a 2D map
<!-- ❌ Anti-pattern -->
<arcgis-map><arcgis-direct-line-measurement-3d></arcgis-direct-line-measurement-3d></arcgis-map><!-- ✅ Correct -->
<arcgis-map><arcgis-distance-measurement-2d></arcgis-distance-measurement-2d></arcgis-map>Impact: measured: start() resolves, state becomes "unsupported" and the only sign is a console warning.
Likewise arcgis-measurement accepted activeTool = "direct-line" on a 2D map and showed no tool
(activeWidget: null).
Pitfall 3: Expecting sketch drawings to persist
// ❌ Anti-pattern
// Drawing with arcgis-sketch and assuming it saves to the service.// ✅ Correct
sketch.addEventListener("arcgisCreate", (e) => {
if (e.detail.state === "complete") void parcels.applyEdits({ addFeatures: [e.detail.graphic!] });
});Impact: drawings are client-side graphics in the "Sketch Layer"; they vanish on reload.
When to Read references/
| If you need... | Read |
| Tool component attributes/events | references/api-detail.md |
| Sketch / measure / snap examples | references/examples.md |
| More pitfalls (5+ extended) | references/pitfalls.md |
Related Skills
arcgis-interaction— programmatic SketchViewModelarcgis-editing— persist drawn geometryarcgis-core-maps— the map/scene to bind to
Reference Samples
Changelog
- 0.2.0 (2026-10-27): SDK 5.1. Measured in
tests/runtime/casos/arcgis-map-tools.ts. The skill said snapping controls "wire to the active sketch": false, each component has its ownsnappingOptionsand they must be shared by reference (now the top pitfall). The 3D-on-2D pitfall is now precise (state: "unsupported", console warning only). Added measurement analyses in code (5.5 km geodesic for a 0.05° line at 4.6°N), the component defaults, andFeatureSnappingLayerSource. Replaced pitfalls that were only comments. - 0.1.0 (2026-05-31): Initial release.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

