Skip to Territory Explorer
By Chason ArthurRevision 108.037Updated

02 / GEOGRAPHIC INTELLIGENCE

See the territory.
Find the gap.

One coverage question, three connected views. Filter synthetic dealers, inspect the map, and compare the service load across regions.

OPTIONAL / LOCAL RECORDING PREPARATION

Prepare a take. Keep the person's settings.

Confirming a scene creates a memory-only route and table. The first checkpoint survives repeated resets; saved geographic, table and appearance preferences stay untouched. This does not start screen capture. Presentation views only reframe the same live data; they never reset the query or load the SDK. An already-loaded public map may redraw tiles when its viewport changes.

Normal demo. No recording checkpoint exists. Reload resumes saved preferences; an in-memory checkpoint cannot survive it.

A reset/restore pauses the optional map and never loads the SDK or moves its camera. If a previous map view exists, restoring its camera/layers is a separate explicit action that may request public tiles. Pending query/fixture work is invalidated or cancelled, never replayed.

Read the route-specific script and shot outline · Read the complete recording playbook

—matching locations
—synthetic open tickets
—regions in this query
—Local WGS84 · ms

01 / SPATIAL VIEW

Territory map

Link to map view
Use records instead ↓

Bring the geography into view.

The record list and comparisons work immediately. Load ArcGIS when you want to explore the map.

Loads ArcGIS Maps SDK 5.1.27 and a public Esri basemap. No key is used.

Map not loaded. All query controls and records are available without it.

02 / LINKED COMPARISON

Where the work sits

Link to geographic comparison
FILTERED / TOTAL

Select a region to narrow the same map and record query. Bars compare matching locations with the full synthetic region.

Current geographic comparison, the same values shown in the bars
RegionMatched / totalOpen ticketsSynthetic revenue

03 / ACCESSIBLE RECORD VIEW

Every location. One source.

Link to records
Loading records

Loading the synthetic dataset…

Search, sort, filter, paginate and select records without using the map. The selected record appears below; DataTables preferences are saved separately for this route and table.

Select a record to inspect its details.

THE SERVICE BOUNDARY

One response is not all the data.

Link to service fixture

A bounded fixture imitates a service with a 17-feature transfer limit. The adapter enumerates IDs, retrieves batches, splits truncated batches and rejects incomplete results.

Deterministic fixture. No external feature service is queried.

PROVENANCE & LIMITS

Clear boundaries make a useful demo.

Link to provenance and limits

Shared synthetic data is bundled with the Lab. ArcGIS renders a client-side FeatureLayer. Public raster tiles provide context and retain Esri attribution. Filter timing is a measured browser operation, not a production benchmark.

There is no hosted feature service, scheduled data pipeline, paid routing, or production access in this demonstration. Hosting, update and rollback architecture are explained in the tutorial.

Read the architecture & release steps →

Lab discussion / GIS Territory Explorer

What would you try next?

Ask about the code, compare an approach, or describe an edge case. Reader comments are reviewed before publication.

All lab discussions

Reader comments

Open the discussion to read and add reader comments.

Read or write a comment →

Code walkthrough

Follow the implementation in code.

These short excerpts connect the lab’s behavior to its implementation. Each example links to the full tutorial step for its context, tradeoffs and checkpoint. Names and dependencies belong to that source; the excerpts are not standalone programs.

Example 01 · Tutorial excerpt

Describe a location before drawing it

Objective and prerequisites. Start from the existing Zyel repository, preserve the Celebration route, and work on an isolated branch. Start from the reviewed Lab checkout or its explicitly supplied committed reference, which must contain this demo and lab/tools/serve.mjs . The draft package can precede its merge into the default branch. The file preflight below stops before creating a worktree if the selected commit lacks either asset. Uncommitted owner edits are preserved in the original checkout and are not copied to a new worktree. You also need a supported Node.js runtime for tests and a local HTTP server for browser modules. No ArcGIS account, API key or database is needed for this fixture.

// One row from the shared contract; values shown here are illustrative.
{
  id: 'D001', name: 'Synthetic Dealer 01', city: 'Atlanta',
  state: 'GA', region: 'Georgia', lat: 33.749, lon: -84.388,
  tickets: 12, revenue: 48000, status: 'Active'
}

// ArcGIS uses its own numeric object ID; keep the business ID too.
const sourceFeatures = dealers.map(toFeature);

Read the full tutorial step

Example 02 · Tutorial excerpt

Keep the saved view separate from location data

Objective and prerequisites. Save a person's geographic filters, layer visibility and view extent on this device. Start with the shared createStore() module and the contract from step 1. Persist preferences only; records and selected business details stay in memory.

const defaultState = {
  filters: {...DEFAULT_FILTERS}, extent: null,
  pointsVisible: true, basemapVisible: true
};
const store = createStore('territory:preferences', defaultState,
  value => Boolean(normalizePreferences(value, regions, statuses)));
let state = store.get();
store.set(state);

Read the full tutorial step

Example 03 · Tutorial excerpt

Test the spatial selection without a map

Objective and prerequisites. Combine attribute filters with either a radius or captured map extent. You need the WGS84 fixture and pure functions; the map is optional at this stage.

const matches = filterDealers(dealers, {
  region: 'all', status: 'all', mode: 'radius',
  centerLat: 33.749, centerLon: -84.388, radiusKm: 150
}, null);

// The actual implementation also composes region/status predicates.
if (filters.mode === 'radius' &&
    distanceKm(center, row) > filters.radiusKm) return false;

Read the full tutorial step

Example 04 · Tutorial excerpt

Link a table selection to the map

Objective and prerequisites. Keep the map, searchable DataTable and regional comparisons consistent. The shared table helper, accepted query result and stable ID maps from earlier steps must be available. In this focused integration excerpt, table , matches and renderComparisons() are the local collaborators. objectIdByDealer maps the source features' business IDs to their positive integer ObjectIDs. Initialize mapContext as undefined and mapPaused as false; set the context only after step 4 obtains its layer view, and pause it while a recording scene retains the hidden map.

table = await createTable({
  element: document.getElementById('dealer-table'),
  tableId: 'territory-dealers', columns, data: matches,
  onSelect: selectRecord
});

function renderResult(rows) {
  matches = rows;
  table?.replace(matches);
  renderComparisons();
  if (mapContext && !mapPaused) {
    // IDs are looked up in the validated fixture, never user SQL.
    const ids = matches.map(d => objectIdByDealer.get(String(d.id)))
      .filter(id => Number.isSafeInteger(id) && id > 0);
    mapContext.layerView.filter = {where: ids.length
      ? `ObjectID IN (${ids.join(',')})` : '1=0'};
  }
}

Read the full tutorial step

Example 05 · Tutorial excerpt

Verify the spatial rules and module syntax

Objective and prerequisites. Establish reproducible evidence without inventing throughput or scale claims. You need the local fixture, Node.js, the browser preview and the delivered test scripts.

node --test lab/territory/tests/spatial.test.mjs
node --check lab/territory/app.mjs
node lab/territory/benchmark.mjs
# Browser: test /lab/territory/ at desktop and narrow widths.
# Verify both the normal network and an unavailable ArcGIS CDN.

Read the full tutorial step