arcgis-layers
Skill1 starsChanged 6 months agoMITView on GitHub
Add and query data layers with the ArcGIS Maps SDK for JavaScript 5.1: FeatureLayer, GeoJSONLayer, CSVLayer, GraphicsLayer, and TileLayer. Covers queryFeatures with createQuery (which carries definitionExpression; a plain where drops it), the silent maxRecordCount cap and exceededTransferLimit, pagination (start/num), outFields, and load errors. Use this skill whenever the user adds data to a map, queries features, or filters/loads a layer.
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-map-toolsSkill
- arcgis-parquetSkill
- arcgis-performanceSkill
- arcgis-popup-templatesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 73
Always start from layer.createQuery().
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Layers
When to use: Activate this skill whenever the user adds data to a map, runs a feature query, filters with a definition expression, or loads GeoJSON/CSV/graphics/tiles.
Overview
Layers are the data you put on a map. Pick the layer type by data source, then query and filter it on the server.
- Problem it solves: loading the right layer type and reading its features correctly and efficiently.
- Who it serves: developers adding operational data to a map or scene.
- Pattern it teaches: source-driven layer choice,
createQuery()for every read, server-side filters, paging. - What it does NOT cover: symbology (see
arcgis-visualization) or 3D layers (seearcgis-3d-layers).
Quick Start
import FeatureLayer from "@arcgis/core/layers/FeatureLayer.js";
const layer = new FeatureLayer({ url: "https://.../FeatureServer/0", outFields: ["NAME", "POP"] });
map.add(layer);
const query = layer.createQuery(); // starts from the layer's definitionExpression
query.where = `(${query.where}) AND POP > 1000000`; // add to it, do not overwrite it
query.outFields = ["NAME", "POP"];
const { features, exceededTransferLimit } = await layer.queryFeatures(query);Measured with 5.1.27 on a public 3557-row service: queryFeatures() with no paging returns 1000 rows (the
service's maxRecordCount) and exceededTransferLimit: true, with no error.
Decision Tree
- What is the data source?
- Hosted/ArcGIS feature service →
FeatureLayer. .geojsonfile/URL →GeoJSONLayer(WGS84; geometry type and fields are inferred)..csvwith coordinates →CSVLayer(lat/lonstyle names are detected; others needlatitudeField/longitudeField).- Client-side graphics you draw →
GraphicsLayer. - Pre-rendered tiles →
TileLayer.
- Hosted/ArcGIS feature service →
- Reading features?
- Always start from
layer.createQuery(); add to itswhere. - More rows than
maxRecordCount→ page withstart/num+orderByFields, orqueryFeatureCountfirst.
- Always start from
Default: FeatureLayer + createQuery() for service data; GraphicsLayer for ad-hoc client graphics.
Import Patterns
Direct ESM (recommended for npm/Vite/Webpack)
import FeatureLayer from "@arcgis/core/layers/FeatureLayer.js";
import Query from "@arcgis/core/rest/support/Query.js";Dynamic Imports (CDN)
const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");Map Components (recommended for new projects)
// Layers are still created with the Core API, then added to the component's map.
import "@arcgis/map-components/components/arcgis-map";Key Concepts
Concept 1: definitionExpression lives in createQuery, not in queryFeatures
definitionExpression filters what the layer draws. For queries, it only applies because createQuery() copies
it into query.where. Measured with definitionExpression: "st = 'TX'": replacing query.where with
"pop2000 > 500000" counted 29 cities (the whole country); a plain { where } object or new Query() gave the same
29; (${query.where}) AND pop2000 > 500000 gave the right 6.
Concept 2: createQuery() vs new Query()
createQuery() starts with where = the layer filter (or 1=1), returnGeometry: true and outFields: ["*"],
even when the layer has its own outFields (measured: all 6 fields came back). new Query() starts with
returnGeometry: false and outFields: null: measured, geometry null and only the display field. The layer's
outFields controls what the view loads for drawing, hit tests and popups, not what queryFeatures returns.
Concept 3: The silent cap and paging
A query returns at most the service's maxRecordCount rows and sets exceededTransferLimit: true; nothing throws.
Page with start/num and a stable orderByFields (measured: page 1 New York, Los Angeles, Chicago; page 2
Houston, Philadelphia, Phoenix), or count first with queryFeatureCount.
Common Pitfalls (Top 3)
Pitfall 1: Overwriting the where that carries the layer filter
// ❌ Anti-pattern
const layer = new FeatureLayer({ url, definitionExpression: "st = 'TX'" });
const q = layer.createQuery();
q.where = "pop2000 > 500000"; // the TX filter is gone// ✅ Correct
const q = layer.createQuery();
q.where = `(${q.where}) AND pop2000 > 500000`;Impact: measured: 29 results instead of 6. The map shows Texas only, while the list, the count and the export cover the whole country.
Pitfall 2: Filtering client-side what the server capped
// ❌ Anti-pattern
const all = await layer.queryFeatures();
const capitals = all.features.filter((f) => f.attributes.capital === "Y");// ✅ Correct
const q = layer.createQuery();
q.where = "capital = 'Y'";
const { features } = await layer.queryFeatures(q);Impact: measured: the unfiltered query stopped at 1000 of 3557 rows (exceededTransferLimit: true), so the
client filter found 11 capitals; the server-side where found all 51. It is wrong, not only slow.
Pitfall 3: Building a new Query() and expecting geometry
// ❌ Anti-pattern
const q = new Query({ where: "1=1", num: 10 }); // returnGeometry false, outFields null
const { features } = await layer.queryFeatures(q);
view.goTo(features); // geometry is null// ✅ Correct
const q = layer.createQuery(); // returnGeometry true; or set q.returnGeometry = true and q.outFields
q.num = 10;Impact: measured: geometry === null and the attributes held only the display field.
When to Read references/
| If you need... | Read |
| Layer + Query signatures | references/api-detail.md |
| GeoJSON, CSV, query examples | references/examples.md |
| More pitfalls (5+ extended) | references/pitfalls.md |
Related Skills
arcgis-core-maps— the map/view the layers go onarcgis-visualization— symbolize the layersarcgis-3d-layers— 3D layer types
Reference Samples
Changelog
- 0.2.0 (2026-10-27): SDK 5.1. Measured in
tests/runtime/casos/arcgis-layers.tson a public 3557-row service. New top pitfall: overwritingcreateQuery().wheredrops the layer'sdefinitionExpression(29 results instead of 6). The Quick Start usedoutFields: ["*"]against its own advice. The old pitfall 3 ("returnGeometry defaults vary") is now precise:createQuery()istrue,new Query()isfalse. Client-side filtering is shown to be wrong, not only slow (1000-row cap: 11 capitals instead of 51). LayeroutFieldsdo not limitqueryFeatures. - 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.

