Skip to content
cccskills
FreePublished on GitHub

portaljs-add-geo

Prepare a vector geospatial dataset for a PortalJS portal by converting its coordinate system, creating a map-ready PMTiles file and a queryable GeoParquet file, and registering both with the original data for an automatically rendered showcase.

OriginalShow the original description

Auto-ingest a geospatial file (GeoJSON, Shapefile, GeoPackage, KML/KMZ, FlatGeobuf, CSV-with-geometry) into a PortalJS portal on the user's own machine, with no server. Normalizes CRS to EPSG:4326, derives a PMTiles render tier and a GeoParquet query tier, pushes all three artifacts to Cloudflare R2 via Git LFS, and appends one dual-tier datasets.json entry the showcase auto-renders. Use when the source is a vector geo format that needs a map or spatial-query view.

Works withCloudflare

Run score Not tested

See how to install

Good for

  • Turn GeoJSON into a portal map and spatial query view
  • Ingest a zipped Shapefile from a URL
  • Publish a GeoPackage layer with its original file

Files included (2)

  • SKILL.md6.8 KB
  • references/reference.md5.0 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

PortalJS — Add Geo

Overview

Turn one geospatial upload into a dual-tier PortalJS dataset entirely on the user's machine — no server-side container compute, keeping the zero-backend bet end-to-end. From a single source the skill derives two serverless tiers plus the preserved original:

  • PMTiles (render tier) — a vector-tile archive <MapPreview> renders with MapLibre GL over HTTP range requests; any dataset size pans and zooms with no tile server.
  • GeoParquet (query tier) — a GeoParquet 1.1 file (covering bbox column, Hilbert-sorted) <GeoQuery> runs spatial SQL over in place via DuckDB-Wasm.
  • Original — the untouched upload in its native CRS, kept downloadable.

All three land on Cloudflare R2 (Git LFS → Giftless), and the skill appends one datasets.json entry whose resources[] match the shape the showcase auto-renders (the @reference/world-boundaries demo, PR #1647): pmtiles → <MapPreview>, geoparquet → <GeoQuery>, original → download. No page edits are needed. It automates the manual tippecanoe/duckdb recipes in the template README.

Prerequisites

  • A scaffolded portaljs-catalog portal whose template ships components/MapPreview.tsx and components/GeoQuery.tsx (PR #1647 or later).
  • Native CLIs on the user's machine: GDAL (ogr2ogr, ogrinfo), tippecanoe, and duckdb (with the spatial extension). macOS: brew install gdal tippecanoe duckdb; Debian/Ubuntu: apt-get install gdal-bin duckdb + tippecanoe (apt or build from source); Windows: use WSL. The skill hard-stops with the install hint if any is missing.
  • Arc credentials for the Git-LFS → R2 push (the same token portaljs-deploy resolves), or an OSS self-hosted Giftless.

Instructions

The canonical, full step-by-step workflow is .claude/commands/portaljs-add-geo.md — the single source of truth. Read and follow it when executing. Summary:

  1. Gather input — source (geo file path or URL), portal directory, namespace. Interview if missing; never dead-end.
  2. Detect the native tools (ogr2ogr, tippecanoe, duckdb + spatial). Any missing → print the per-OS install and stop.
  3. Validate the portal directory and confirm the geo showcase components exist.
  4. Fetch (if URL) and detect the input format; reject raster and bare .shp.
  5. Preserve the original, then normalize to EPSG:4326 GeoJSON with ogr2ogr -t_srs EPSG:4326.
  6. Apply the size escape hatch (measure normalized-GeoJSON bytes): warn ≥ 500 MB; skip PMTiles and emit GeoParquet-only > 2 GB (documented, never silent).
  7. Derive PMTiles with tippecanoe -zg --drop-densest-as-needed.
  8. Derive GeoParquet with duckdb — covering bbox STRUCT + ST_Hilbert order; verify a range read.
  9. Track all three files with Git LFS, mint an Arc JWT, push to R2, prune, and build the absolute data.portaljs.com URLs.
  10. Append one dual-tier datasets.json entry (pmtiles + geoparquet + original resources).
  11. Verify: npx tsc --noEmit and a Range: 206 check on the R2 URL.
  12. Report the tiers, manifest entry, and showcase route.

Output

  • Created: data/<slug>.pmtiles, data/<slug>.parquet, data/<slug>.<origext> (all LFS-tracked → R2); data/<slug>.4326.geojson (intermediate; can be pruned).
  • Modified: datasets.json (one dual-tier entry appended); .gitattributes (LFS tracking).
  • Verified: npx tsc --noEmit passes; the R2 URLs answer HTTP 206 range reads.
  • Result: /@<namespace>/<slug> renders the PMTiles map and the GeoParquet spatial-query panel together, with no page edits.

Error Handling

SymptomCauseFix
MISSING_TOOLSogr2ogr/tippecanoe/duckdb (or duckdb spatial) absentPrint the per-OS install line and stop; re-run after installing.
UNSUPPORTED_FORMATRaster .tif/.tiff (COG tier, later phase)Use portaljs-add-dataset for tabular; await the COG phase.
SHAPEFILE_NOT_ZIPPEDBare .shp with no siblingsZip the whole .shp/.dbf/.shx/.prj set and pass the .zip.
MULTI_LAYERGPKG/KML with more than one layerList layers and ask which to ingest; pass the layer name.
REPROJECTION_FAILEDogr2ogr error, often a missing .prjShow stderr; re-run with -s_srs EPSG:<code>.
EMPTY_OUTPUTNormalized GeoJSON has 0 featuresCheck the geometry column / CRS of the source.
TILING_FAILED / GEOPARQUET_FAILEDtippecanoe or duckdb non-zeroShow stderr; for very large inputs see the size escape hatch.
LFS_PUSH_FAILEDMissing/expired Arc token or unset lfs.urlRe-mint the JWT (see portaljs-deploy); confirm git config lfs.url.

Examples

Example 1 — Ingest a GeoJSON into both tiers

/portaljs-add-geo source=./data/rivers.geojson name="World Rivers" namespace=reference

Example 2 — Zipped Shapefile from a URL

/portaljs-add-geo source=https://example.com/admin-boundaries.zip slug=admin-boundaries

Example 3 — GeoPackage with an explicit layer and namespace

/portaljs-add-geo source=./data/census.gpkg slug=census-tracts namespace=statistics

Resources

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Migrate an ArcGIS Hub open data site into a PortalJS catalog. The skill collects the inventory, exports and converts spatial and tabular data for publishing, uploads files to Cloudflare R2 through Git LFS, and produces a report comparing source and derived data.

  • Moving a city ArcGIS Hub catalog to PortalJS
  • Migrating selected datasets from a Hub site
  • Comparing exported data with its ArcGIS source
datopian/portaljs2.4KUpdated Oct 24, 2026

Add a line, bar, area, pie, or scatter chart to the showcase for a dataset already registered in PortalJS. The skill creates a reusable Chart component and displays it in the dataset’s Views section using the existing data source.

  • Show yearly emissions as a line chart
  • Compare imports and exports with grouped series
  • Display a categorical budget breakdown as a pie chart
datopian/portaljs2.4KUpdated Oct 24, 2026

Register a CSV, TSV, JSON, or GeoJSON source in an existing PortalJS portal. The skill adds it to the dataset catalog and routes local files or remote URLs so the catalog and showcase can display the data.

  • Register a local CSV in a PortalJS catalog
  • Add a public dataset URL without copying the file
  • Publish a GeoJSON dataset through the portal
datopian/portaljs2.4KUpdated Oct 24, 2026

Generate DCAT catalog feeds for a PortalJS site so open data catalogs can harvest its datasets. The skill supports JSON-LD, Turtle, and RDF/XML formats, adds feed discovery, and checks conformance to selected profiles.

  • Making a PortalJS catalog harvestable by an EU open data portal
  • Preparing feeds for a US or national open data catalog
  • Publishing catalog metadata in multiple RDF formats
datopian/portaljs2.4KUpdated Oct 24, 2026

portaljs-add-map

FreeSummary

Add an interactive Leaflet map to a selected GeoJSON dataset’s PortalJS showcase. The skill can register a local or remote GeoJSON source, install the map dependencies, and render the map in the page’s Views section.

  • Show a map alongside a registered GeoJSON dataset
  • Register a local GeoJSON file and display it on a map
  • Add a remote GeoJSON source to a PortalJS showcase
datopian/portaljs2.4KUpdated Oct 24, 2026

Add another file to an existing PortalJS dataset, such as a data dictionary, methodology document, or another period of data. The skill updates the dataset manifest and makes the showcase display a section for each resource.

  • Adding a data dictionary to an existing dataset
  • Attaching a methodology document to a dataset
  • Adding another period's data as a separate resource
datopian/portaljs2.4KUpdated Oct 24, 2026

See all skills by datopian

Report a problem with this skill