feat: land use crop mapping integration (Issue #152) #154

Closed
ned wants to merge 4 commits from issue-152-land-use-soil-data into main
Member

Land Use & Crop Data Integration

This PR adds the first phase of land use data integration for Nidus Reveal (Issue #152), pulling CA DWR 2024 Statewide Crop Mapping data from ArcGIS into the parcel report.

What this includes

Database (migrations 00203-00204):

  • municipal.crop_polygon — caches CA DWR crop polygons locally (~456k polygons statewide)
  • municipal.parcel_crop — pre-computed parcel-crop intersection results with proportions
  • municipal-land-use-sync job type added to JobType PG enum

Backend (platform/land_use.go):

  • ArcGIS REST client for CA DWR 2024 Provisional Crop Mapping feature service (utility.arcgis.com, no auth required)
  • Paginated polygon queries by spatial envelope
  • Polygon conversion: ArcGIS rings → go-geom → PostGIS WKT
  • Full field extraction: CLASS1-4, SUBCLASS1-4, CROPTYP1-4, SPECOND1-4, IRR_TYP1-4, PCNT1-4, MAIN_CROP, MAIN_CROP_DATE, YR_PLANTED, ACRES, COUNTY, HYDRO_RGN
  • QueryCropPolygons() — query the DWR service
  • IngestCropPolygons() — store with dedup
  • ComputeParcelCropIntersections() — PostGIS spatial join for per-parcel proportions
  • GetParcelLandUse() — retrieve crop data for a parcel report
  • LandUseSyncStart() / LandUseJobSync() — background job driver
  • LandUseSyncStatus() — polygon/intersection counts

API endpoints:

  • POST /municipal/land-use/sync — trigger full sync
  • GET /municipal/land-use/status — check progress
  • GET /municipal/parcel/{id}/crop — per-parcel crop data

Site report integration:

  • crop_results added to MunicipalParcel response type
  • Site hydration batch-loads crop data (N+1 avoidance)

Still to come (building in parallel on the same branch)

  • Frontend display on the feature/site detail page
  • Toggleable map layer showing crop polygons
  • Soil data (gSSURGO) integration
  • Closes the land use portion of #152 (soil data and UI to follow)

Testing

  • CI run #882 passed on commit 8c7a826
  • CI run #892 passed on commit 0441c748
## Land Use & Crop Data Integration This PR adds the first phase of land use data integration for Nidus Reveal (Issue #152), pulling CA DWR 2024 Statewide Crop Mapping data from ArcGIS into the parcel report. ### What this includes **Database (migrations 00203-00204):** - `municipal.crop_polygon` — caches CA DWR crop polygons locally (~456k polygons statewide) - `municipal.parcel_crop` — pre-computed parcel-crop intersection results with proportions - `municipal-land-use-sync` job type added to JobType PG enum **Backend (platform/land_use.go):** - ArcGIS REST client for CA DWR 2024 Provisional Crop Mapping feature service (utility.arcgis.com, no auth required) - Paginated polygon queries by spatial envelope - Polygon conversion: ArcGIS rings → go-geom → PostGIS WKT - Full field extraction: CLASS1-4, SUBCLASS1-4, CROPTYP1-4, SPECOND1-4, IRR_TYP1-4, PCNT1-4, MAIN_CROP, MAIN_CROP_DATE, YR_PLANTED, ACRES, COUNTY, HYDRO_RGN - `QueryCropPolygons()` — query the DWR service - `IngestCropPolygons()` — store with dedup - `ComputeParcelCropIntersections()` — PostGIS spatial join for per-parcel proportions - `GetParcelLandUse()` — retrieve crop data for a parcel report - `LandUseSyncStart()` / `LandUseJobSync()` — background job driver - `LandUseSyncStatus()` — polygon/intersection counts **API endpoints:** - `POST /municipal/land-use/sync` — trigger full sync - `GET /municipal/land-use/status` — check progress - `GET /municipal/parcel/{id}/crop` — per-parcel crop data **Site report integration:** - `crop_results` added to `MunicipalParcel` response type - Site hydration batch-loads crop data (N+1 avoidance) ### Still to come (building in parallel on the same branch) - Frontend display on the feature/site detail page - Toggleable map layer showing crop polygons - Soil data (gSSURGO) integration ### Related issues - Closes the land use portion of #152 (soil data and UI to follow) ### Testing - CI run #882 passed on commit 8c7a826 - CI run #892 passed on commit 0441c748
eliribble force-pushed issue-152-land-use-soil-data from f4154d846a
All checks were successful
/ golint (push) Successful in 13s
/ pnpm-build (push) Successful in 26s
to 862f0c977b
Some checks failed
/ golint (push) Failing after 0s
/ pnpm-build (push) Failing after 0s
2026-08-29 22:18:11 +00:00
Compare
Owner

Closing for now, we may come back to this much later

Closing for now, we may come back to this much later
eliribble closed this pull request 2026-09-05 00:31:50 +00:00
Some checks failed
/ golint (push) Failing after 0s
/ pnpm-build (push) Failing after 0s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Gleipnir/nidus-sync!154
No description provided.