feat: land use crop mapping integration (Issue #152) #154
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-152-land-use-soil-data"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 proportionsmunicipal-land-use-syncjob type added to JobType PG enumBackend (platform/land_use.go):
QueryCropPolygons()— query the DWR serviceIngestCropPolygons()— store with dedupComputeParcelCropIntersections()— PostGIS spatial join for per-parcel proportionsGetParcelLandUse()— retrieve crop data for a parcel reportLandUseSyncStart()/LandUseJobSync()— background job driverLandUseSyncStatus()— polygon/intersection countsAPI endpoints:
POST /municipal/land-use/sync— trigger full syncGET /municipal/land-use/status— check progressGET /municipal/parcel/{id}/crop— per-parcel crop dataSite report integration:
crop_resultsadded toMunicipalParcelresponse typeStill to come (building in parallel on the same branch)
Related issues
Testing
8c7a8260441c748Why: The DWR crop polygon ingestion and parcel intersection computation needs to be triggerable as a background job, exposed via API endpoints for the admin UI, and surfaced in the site/parcel report. - Migration 00204: add 'municipal-land-use-sync' to JobType PG enum - jobtype.go model: add Jobtype_MunicipalLandUseSync constant + scan - background.go: add NewLandUseSync helper function - start.go (handleJob): route to LandUseJobSync - land_use.go: LandUseSyncStart creates a background job; LandUseJobSync queries DWR ArcGIS, ingests polygons, and computes parcel-crop intersections for all districts; LandUseSyncStatus returns row counts - types/parcel.go: add ParcelCropResult type and crop_results field to MunicipalParcel so the site report carries crop data - site.go (sitesHydrate): batch-load crop data for all municipal parcels via loadCropDataForParcels, avoids N+1 queries - resource/municipal.go: handlers for POST /municipal/land-use/sync, GET /municipal/land-use/status, GET /municipal/parcel/{id}/crop - api/routes.go: register the three new land-use routesf4154d846a862f0c977bClosing for now, we may come back to this much later
Pull request closed