Portaljs add geo
π AI-native framework for building data portals. Scaffold a full portal from a brief and load datasets in minutes with agentic skills β any backend (CKAN, GitHub, Frictionless).
npx -y skills add datopian/portaljs --skill portaljs-add-geoAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
What its author says it does
Copied from the file, not written here
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.
The file declares its own license as MIT. That is the authorβs claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
6.8 KB, as published. Nobody here has run it
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
bboxcolumn, 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-catalogportal whose template shipscomponents/MapPreview.tsxandcomponents/GeoQuery.tsx(PR #1647 or later). - Native CLIs on the user's machine: GDAL (
ogr2ogr,ogrinfo), tippecanoe, and duckdb (with thespatialextension). 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-deployresolves), 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:
- Gather input β source (geo file path or URL), portal directory, namespace. Interview if missing; never dead-end.
- Detect the native tools (
ogr2ogr,tippecanoe,duckdb+spatial). Any missing β print the per-OS install and stop. - Validate the portal directory and confirm the geo showcase components exist.
- Fetch (if URL) and detect the input format; reject raster and bare
.shp. - Preserve the original, then normalize to EPSG:4326 GeoJSON with
ogr2ogr -t_srs EPSG:4326. - Apply the size escape hatch (measure normalized-GeoJSON bytes): warn β₯ 500 MB; skip PMTiles and emit GeoParquet-only > 2 GB (documented, never silent).
- Derive PMTiles with
tippecanoe -zg --drop-densest-as-needed. - Derive GeoParquet with
duckdbβ coveringbboxSTRUCT +ST_Hilbertorder; verify a range read. - Track all three files with Git LFS, mint an Arc JWT, push to R2, prune, and build the
absolute
data.portaljs.comURLs. - Append one dual-tier
datasets.jsonentry (pmtiles+geoparquet+ original resources). - Verify:
npx tsc --noEmitand aRange:206 check on the R2 URL. - 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 --noEmitpasses; 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
| Symptom | Cause | Fix |
|---|---|---|
MISSING_TOOLS | ogr2ogr/tippecanoe/duckdb (or duckdb spatial) absent | Print the per-OS install line and stop; re-run after installing. |
UNSUPPORTED_FORMAT | Raster .tif/.tiff (COG tier, later phase) | Use portaljs-add-dataset for tabular; await the COG phase. |
SHAPEFILE_NOT_ZIPPED | Bare .shp with no siblings | Zip the whole .shp/.dbf/.shx/.prj set and pass the .zip. |
MULTI_LAYER | GPKG/KML with more than one layer | List layers and ask which to ingest; pass the layer name. |
REPROJECTION_FAILED | ogr2ogr error, often a missing .prj | Show stderr; re-run with -s_srs EPSG:<code>. |
EMPTY_OUTPUT | Normalized GeoJSON has 0 features | Check the geometry column / CRS of the source. |
TILING_FAILED / GEOPARQUET_FAILED | tippecanoe or duckdb non-zero | Show stderr; for very large inputs see the size escape hatch. |
LFS_PUSH_FAILED | Missing/expired Arc token or unset lfs.url | Re-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
- Full workflow:
.claude/commands/portaljs-add-geo.md - Flags, thresholds, and the dual-tier manifest shape:
references/reference.md - Related skills:
portaljs-add-dataset,portaljs-add-map,portaljs-add-resource,portaljs-deploy - tippecanoe: https://github.com/felt/tippecanoe Β· DuckDB spatial: https://duckdb.org/docs/extensions/spatial