arcgis-rest-services
Skill1 starsChanged 6 months agoMITView on GitHub
Call ArcGIS location services with the ArcGIS Maps SDK for JavaScript 5.1 rest modules: route (directions), locator (geocoding), places (POI search), and standalone queries against feature services. Covers what happens without an API key (a sign-in dialog and a promise that never settles, not a 401), route stops as FeatureSet or Collection<Stop>, and the silent query results (0 features on a service root, 1000-row cap, no geometry by default). Use this skill whenever the user geocodes an address, solves a route, searches places, or runs a standalone query against a REST endpoint.
- Reads credentials
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-map-toolsSkill
- arcgis-parquetSkill
- arcgis-performanceSkill
- The first 60 shown.
The file
Files
REST Services
When to use: Activate this skill whenever the user geocodes, routes, searches places, or runs a standalone REST query.
Overview
The rest/* modules are function wrappers over ArcGIS location and feature services.
- Problem it solves: routing, geocoding, place search, and ad-hoc queries.
- Who it serves: developers integrating location services.
- Pattern it teaches:
import * as <service>; call its function with a URL + a typed parameters object. - What it does NOT cover: geoprocessing (see
arcgis-spatial-analysis) or auth setup (seearcgis-authentication).
Quick Start
import esriConfig from "@arcgis/core/config.js";
import * as locator from "@arcgis/core/rest/locator.js";
esriConfig.apiKey = import.meta.env.VITE_ARCGIS_API_KEY as string; // before the first call
const GEOCODE_URL = "https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer";
const candidates = await locator.addressToLocations(GEOCODE_URL, {
address: { SingleLine: "Plaza de Bolívar, Bogotá" },
maxLocations: 3,
outFields: ["Addr_type", "City", "Country"], // attributes are empty without it
});
const best = candidates[0]; // undefined when nothing matchesDecision Tree
- What task?
- Address → coords →
locator.addressToLocations. - Coords → address →
locator.locationToAddress. - Directions →
route.solve(url, new RouteParameters({ stops })),stopsaFeatureSetorCollection<Stop>. - POI search →
places.queryPlacesNearPoint(new PlacesQueryParameters({ point, searchText }))(no URL argument). - Standalone feature query →
query.executeQueryJSON(layerUrl, query), with the layer index in the URL.
- Address → coords →
- Esri world service (geocode-api, route-api, places-api)?
- Yes → set
esriConfig.apiKeyfirst (or sign in, seearcgis-authentication).
- Yes → set
Default: the rest/* module matching the task.
Import Patterns
Direct ESM (recommended for npm/Vite/Webpack)
import * as route from "@arcgis/core/rest/route.js";Dynamic Imports (CDN)
const locator = await $arcgis.import("@arcgis/core/rest/locator.js");Map Components (recommended for new projects)
// The arcgis-search component wraps locator/places for a ready-made UI.
import "@arcgis/map-components/components/arcgis-search";Key Concepts
Concept 1: Function modules
Each service is a namespace of functions (route.solve, locator.addressToLocations). Import the namespace and
call the function with the service URL plus a parameters object. places is the exception: its functions take only
the parameters and use Esri's places service.
Concept 2: Parameter classes
route.solve needs a real RouteParameters, and its stops a FeatureSet of point graphics or a
Collection<Stop>. Measured on a public route service: both solved (a polyline, Total_TravelTime 14.79 min). With
returnDirections: true and directionsLanguage: "es" it returned 12 maneuvers, starting with
Salga desde Location 1; by default there are none.
Concept 3: Results arrive in WGS84, and that is fine
Geocoder results came back with wkid 4326. Added to a Web Mercator view, the point landed at (200, 157) of a
400×300 view centered on it: the view reprojects WGS84 on the fly. Ask for outSpatialReference only when you will
do math in the view's coordinates.
Common Pitfalls (Top 3)
Pitfall 1: Calling a world service without an API key
// ❌ Anti-pattern
await route.solve(WORLD_ROUTE_URL, params); // no esriConfig.apiKey// ✅ Correct
esriConfig.apiKey = import.meta.env.VITE_ARCGIS_API_KEY as string;
await route.solve(WORLD_ROUTE_URL, params);Impact: measured on geocode-api, route-api and places: no 401 and no rejection. The IdentityManager fired
dialog-create, a sign-in calcite-dialog opened, and the promise stayed pending; a catch never runs.
Pitfall 2: Raw stops or a plain parameters object
// ❌ Anti-pattern
route.solve(url, { stops: [[-74.08, 4.6], [-74.05, 4.65]] } as never);// ✅ Correct
const params = new RouteParameters({ stops: new FeatureSet({ features: stopGraphics }) });
route.solve(url, params);Impact: measured: both a raw coordinate array in stops and a plain object instead of RouteParameters failed
before any request, with TypeError: t.toJSON is not a function, an error that does not say what is wrong.
Pitfall 3: Querying the service root instead of a layer
// ❌ Anti-pattern
await query.executeQueryJSON(MAPSERVER_URL, { where: "1=1" });// ✅ Correct
await query.executeQueryJSON(`${MAPSERVER_URL}/0`, { where: "pop2000 > 1000000", outFields: ["areaname"] });Impact: measured: the root returned 0 features and no error; /0 returned 9. On the layer, where: "1=1"
returned 1000 of 3557 rows (exceededTransferLimit: true), and the features had no geometry unless
returnGeometry: true.
When to Read references/
| If you need... | Read |
| route / locator / places / query signatures | references/api-detail.md |
| Geocode / route / query examples | references/examples.md |
| More pitfalls (5+ extended) | references/pitfalls.md |
Related Skills
arcgis-authentication— API keys / OAuth for servicesarcgis-spatial-analysis— geoprocessing servicesarcgis-layers— query layers directly
Reference Samples
Changelog
- 0.2.0 (2026-10-27): SDK 5.1. Measured in
tests/runtime/casos/arcgis-rest-services.ts(public services, no API key). The old "401 without a key" was wrong: the SDK opens a sign-in dialog and the promise never settles. A query on the service root returns 0 features instead of failing. Raw stops fail with an opaquetoJSONTypeError. Removed the false "WGS84 results land offset" pitfall and three comment-only ones (quotas, CORS, esriRequest); added measured ones for directions, outFields, empty matches, returnGeometry and the 1000-row cap.placestakes no URL. - 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.

