Skip to content

ramiisaac/coda-pack-arcgis-connector

Repository files navigation

ArcGIS Connector

ArcGIS Connector is a Coda pack that provides core integration with public ArcGIS REST Services for geographic data access and lightweight spatial analysis. It exposes service discovery, attribute queries, ownership lookups, range analysis, and distance calculations as Coda formulas and a sync table.

Overview

  • Purpose: Query ArcGIS REST feature services from inside Coda and run small spatial computations on the results.
  • Inputs: ArcGIS REST service URLs, SQL WHERE clauses, field names, and geographic coordinates.
  • Outputs: Service catalogs, feature attributes as objects, range/statistic summaries, and distances in miles.
  • Audience: Coda makers who consume open ArcGIS feature services and want to keep query, lookup, and analysis logic inside their docs.

Requirements

  • A Coda account with permission to install Packs.
  • Access to one or more public (or otherwise reachable) ArcGIS REST Services Directory endpoints, for example https://services6.arcgis.com/<org>/ArcGIS/rest/services.
  • Network access from Coda to the arcgis.com domain (declared via pack.addNetworkDomain('arcgis.com')).
  • Familiarity with ArcGIS feature service URLs (.../FeatureServer/<layerId> or .../MapServer/<layerId>) and basic SQL WHERE syntax.

Installation

  1. Install the ArcGIS Connector pack into your Coda doc from the Pack Gallery or by uploading from this repository.
  2. No account connection prompt appears -- the pack uses unauthenticated public endpoints.
  3. Add the AvailableServices sync table to discover services, or call any of the formulas (QueryFeatures, OwnershipLookup, RangeAnalysis, CalculateDistance, ListAllArcGISServices) directly in a formula or column.

Authentication

No authentication required. The pack only declares arcgis.com as a network domain and calls public ArcGIS REST endpoints; if a target endpoint is private, requests will fail with the underlying ArcGIS error.

Formulas

Name Type Description Inputs Returns
QueryFeatures Formula Queries features from an ArcGIS feature/map layer with field selection and WHERE filtering. serviceUrl, optional fields, optional where Array of feature attribute objects
OwnershipLookup Formula Looks up property ownership records for a given owner name on an ArcGIS property service. ownerName, serviceUrl Array of { PropertyID, Address, Owner, TaxInfo } objects
RangeAnalysis Formula Analyzes the distribution of a numeric field within a min/max range. serviceUrl, fieldName, minValue, maxValue Range analysis object (counts and bucketed stats)
CalculateDistance Formula Computes the great-circle distance between two coordinates in miles. lat1, lon1, lat2, lon2 Number (miles)
ListAllArcGISServices Formula Lists all services discovered from an ArcGIS REST Services Directory base URL. baseUrl Array of service descriptors

Tables

AvailableServices

Lists every service discovered under the supplied ArcGIS REST Services Directory base URL. The sync resolves the directory, walks folder/service entries, and emits one row per service keyed by serviceId. The default baseUrl is https://services6.arcgis.com/z6WYi9VRHfgwgtyW/ArcGIS/rest/services; override it to point at any other directory. Sync model: full re-fetch on every sync (no incremental cursor); results are cached in-process for ~5 minutes to avoid hammering the directory during a single execution.

Example usage

Filter parcels and compute distances

  1. Add the AvailableServices sync table and point it at your county's ArcGIS REST directory to find the service URL you need (for example a parcel FeatureServer/0).
  2. In a separate column, call QueryFeatures("https://.../FeatureServer/0", "PIN,Address,Acres", "Acres > 1") to pull all parcels larger than one acre.
  3. Add a column that calls CalculateDistance(thisRow.lat, thisRow.lon, 47.6062, -122.3321) to compute each parcel's distance to a reference point in miles.
  4. Use RangeAnalysis on a numeric field (for example Acres) to bucket parcels into a value range and inspect the distribution.

Limitations

  • Only public/unauthenticated ArcGIS endpoints are supported; the pack does not negotiate ArcGIS tokens or OAuth.
  • QueryFeatures returns attribute fields only; geometry is not projected into the result by default.
  • Result sets are bounded by the underlying service's maxRecordCount. The pack does not perform server-side pagination across that limit.
  • In-memory caches (features, ownership lookups, range analysis) live for ~5 minutes per execution context and are not shared across pack executions.
  • The rate limiter caps outgoing requests at ~5 per second; very large parallel batches may queue.

Troubleshooting

Problem Likely cause Resolution
Empty result from QueryFeatures WHERE clause did not match any features, or the service URL points at a folder rather than a layer Verify the URL ends in /FeatureServer/<id> or /MapServer/<id>, and test the WHERE clause against the service in a browser
serviceUrl is required or similar UserVisibleError A required string parameter was empty or whitespace Re-check the formula inputs; the pack rejects empty strings up front
AvailableServices sync returns nothing The base URL is not an ArcGIS REST Services Directory or the directory is empty Confirm the URL responds with ?f=pjson JSON and lists services/folders
Slow or stalled formulas Per-execution rate limit (5 req/s) is queuing many calls Reduce parallel formula calls or split work across multiple cells
RangeAnalysis returns zero counts minValue/maxValue exclude all records, or the field is non-numeric on the service Check the field type via QueryFeatures and adjust the range

Development notes

  • Entry point: src/pack.ts.
  • Validate: pnpm coda:validate.
  • Build: pnpm coda:build (or pnpm build).
  • Upload: pnpm coda:upload; release with pnpm coda:release.
  • Tests: pnpm test (Jest -- pre-existing; new packs in this workspace default to Mocha).
  • Lint / typecheck / format: pnpm lint, pnpm typecheck, pnpm format.

Repository

License

MIT -- see LICENSE.

Author

Rami Isaac raisaac@icloud.com -- https://github.com/ramiisaac

About

Coda Pack for ArcGIS REST Services: service discovery, feature queries, spatial operations, request caching, and rate limiting.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors