Use land use data in nidus reveal. #152
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Hello,
I have a data source that would be useful to add into the dataset shown on the Nidus reveal UI. This is land use data with the actual kinds of crops used. This is useful to mosquito control districts because like crops have similar irrigation methods and times and also are similar in mosquito production. So for example if corn is producing in one area it is not unlikely that it would be also producing in another area. Being able to see what land use is like for a given parcel will give them insight into how they should approach control.
I would suggest looking for the original source data to find metadata values and possible more recent data.
If you have any questions about this please ask.
https://www.arcgis.com/apps/mapviewer/index.html?layers=39b63601dfb34274899d15a13465644e
Hey Ned, did you see this?
Hi diddly ho, neighborino! 👋
Yep, I saw this — and I dug into the data source. Gosh darn, this is a good one.
What the data is: This is California DWR's 2024 Statewide Crop Mapping (Provisional), produced by Land IQ under contract to DWR. It covers ~14M acres of California with >95% accuracy using satellite/aerial imagery + random forest classification. There are also prior years going back to at least 2014, so there's a nice time series opportunity.
Key details:
gisonline.water.ca.gov(DWR's own ArcGIS Server)For Nidus integration considerations:
arcgis-golibrary can handle this — it supports polygon feature queries and spatial queriesBenjamin — good eye on this data source! The DWR crop mapping is well-established and the provisional 2024 data is already published. If you want, I can help scope out the integration approach or start looking at how the spatial overlay would work.
Okaly-dokely, happy to run with this whenever you want.
Hi diddly ho Ben! 👋
Yep, readin' loud and clear neighborino! I already dug into the data source in my reply above — the CA DWR 2024 Statewide Crop Mapping is a gosh darn nice dataset for this.
So what would be the most helpful next step from your end? I can:
Okaly-dokely, just let me know what you'd like me to run with!
Thank you @ned that looks like a good analysis. Yes. I think that this would be most valuable as a property on the report for any given parcel. So if the select a parcel in Nidus reveal it will tell them what the current known land use is and how dated that information is. Like you say these polygons are often larger than the parcels so a spatial join seems appropriate. In the rare case that there are multiple land use types for a given parcel it would be helpful to include all those that intersect with their relative proportions in the report. What would also be helpful is to have this dataset as a layer in the viewing map so that a user could select it as viewable and can see it and make their own pattern matches with it. Of course this is less relevant for pools, but as we start to get more information on other sources of mosquito production from the satellite information this will become more and more valuable.
So the output that I expect for the above:
Also I wanted to point you to another dataset that will also have clear value: https://www.nrcs.usda.gov/resources/data-and-reports/gridded-national-soil-survey-geographic-database-gnatsgo
This dataset is soil type, This matters a lot because the soil type will have a large impact on if water stands on the surface or seeps into the ground. We can use this to prioritize features (the broader term for potential and actual sources of mosquito production) for ground observation and also to help us analyze our satellite imagery.
Will you also produce the same two deliverable for this dataset as the land use? Please let me know if you have any questions.
Thanks Ben, that’s gosh darn helpful clarity — the two deliverables are real clear now. Let me lay out my thinking on both:
Land Use (CA DWR Crop Mapping)
Sure as shootin’, I can handle both deliverable 1 and 2:
Parcel report — I’ll do a spatial join via arcgis-go: query crop polygons that intersect each parcel, calculate the intersection area proportion, and store the results in a table keyed to parcels. Where multiple crop classes intersect a single parcel, I’ll store all of ’em with their relative proportions (e.g., “Almonds 62%, Corn 38%”) plus the water year the data comes from so you can see how fresh it is. Same pattern we used for the Kings County ArcGIS situs work.
Map layer — the crop polygons themselves make a natural vector layer. I’d serve the crop polygon features (from the same ArcGIS service or our cached copy) as a MapLibre source so users can toggle it on/off in the Nidus map. The DWR data has crop classes 1–4 for multi-cropped fields, so we could color-code by primary crop class — that’d make pattern matching right quick.
Soil Data (gNATSGO)
Diddly-doodley, this one’s a whole different kettle of fish from the crop mapping — it’s a 10-meter raster grid dataset, not vector polygons. It’s distributed as GeoTIFF files via the NRCS Box folder, not a live ArcGIS feature service. That changes the approach:
Parcel report — we’d need to either:
The soil properties available include organic matter, available water capacity, bulk density, pH, depth to water table, flooding frequency, drainage class, etc. — lots of good stuff for prioritizing groundwater observation.
Map layer — a 10m raster is too fine to serve raw through the browser. We’d need to serve it as raster tiles (via something like tegola or a WMTS), or pre-render it at tile zoom levels. We could let users toggle soil type as a raster tile overlay on the map, similar to how satellite imagery works.
Questions for you, neighborino:
Okaly-dokely, just let me know and I’ll get crackin’!
I think we may have some vector version as well: ArcGIS-compatible ready-to-use packages:
Web Soil Survey (interactive, download by AOI):
Does that change anything on the soil side?
Yes please begin work on the land use data. Will you please get a sample of the soil data and tell me what is avialble so I can assess if it has value and what should be part of the report?
Hi diddly ho Ben! 👋
Great additions on the soil data front, neighborino! Yes, those vector resources change things up significantly vs the gNATSGO raster. Here's my analysis:
On the Soil Side: Vector Changes the Game
USA Soils Map Units Feature Service — yep, this is a proper vector polygon feature service with 173 attribute fields derived from SSURGO. It's got all the key properties you'd want for predicting standing water: drainage class, water table depth, flooding frequency, ponding frequency, hydrologic group, soil order, available water storage, K-factor, hydric classification — the whole diddly-doodley works.
However — it requires an ArcGIS subscription. The service on landscape11.arcgis.com is token-gated (returns 499 Token Required). So we can't query it programmatically without an active subscription.
Options for soil data access:
Sample of what's available in the soil data:
The USA Soils Map Units has 173 fields organized from 9 SSURGO tables. The properties most relevant to mosquito control prioritization:
These are the kinds of fields that let us say: "This parcel sits on poorly drained clay soil (Hydrologic Group D) with a shallow water table and a history of ponding — high priority for a field visit."
If you'd like, I can download a sample of the California gSSURGO data and load a few parcels' worth of soil properties into a test table so you can see exactly what a parcel report lookup would look like.
On the Land Use Side: Confirmed ✅
Yes — I'll begin work immediately. Here's the technical approach:
Source: CA DWR 2024 Statewide Crop Mapping (provisional) via utility.arcgis.com proxy
ArcGIS service: Feature layer (layer 0) in a MapServer — supports Query, Map, Data capabilities with JSON, GeoJSON, and PBF output. Publicly accessible, no token needed. Supports geometry-based queries for spatial joins.
Key fields: CLASS1-4 (DWR crop categories like P=Pasture, D=Deciduous, G=Grain, I=Idle, T=Truck Crops), SUBCLASS1-4, CROPTYP1-4 (Land IQ codes like P3=Mixed Pasture, D3=Deciduous, T21=Truck Crops), SPECOND1-4 (Young orchard, Partially Irrigated), IRR_TYP1-4PA/PB (irrigation method), PCNT1-4 (% of field), MAIN_CROP, MAIN_CROP_DATE (NDVI peak), YR_PLANTED (young perennial age), ACRES, COUNTY, HYDRO_RGN
Integration plan:
source_land_use(similar pattern to the arcgis situs tables in Issue #147)I'll create a feature branch and start putting together the PR for the land use integration. Should I also pull a soil data sample while I'm at it so you can see what the report fields would look like?
Okaly-dokely!
@ned I'll take your steer on the soils data and the best approach. I am sure that I could download it once and give it to you, but it is a dataset that is updated annually so it may we worth getting a workflow that goes from the source to whatever output we want. I would add that I will be asking you to calculate a degree day raster in the future and so there will be several layers that are rasters that we will need to process so it is likely that we should just build a reliable pipeline for dealing with them. Do you think you can handle that?
Hi diddly ho Ben! 👋
Short answer: Yes, absolutely I can handle that. Gosh darn, this is right up my alley.
Raster Pipeline — Confident Yes ✅
You're thinkin' sensible here — if we're going to have multiple raster layers (soils, degree days, satellite indices, etc.), we should build a proper raster pipeline once and reuse it. Here's how I see it:
Core pipeline:
Technology: I'd use GDAL (the gosh darn Swiss Army knife of geospatial) for raster processing — either via
os/execcalls togdal_translate,gdalwarp,gdal_calc.py, or via Go GDAL bindings if we need tight control. For degree days, that typically means downloading daily min/max temperature grids (PRISM or Daymet, both free), running degree-day calculations per cell, and producing annual/seasonal degree-day rasters.Automated refresh: We'd set up a scheduled job (cron or our internal scheduler) that checks for new data, downloads updates, reprocesses, and updates the stored raster. Since both gNATSGO/SSURGO and degree-day data update annually, that's a nice predictable cadence.
Soil Data Approach — My Steer
You raise a good point about needing a pipeline anyway for future rasters. Given that:
Option C (hybrid) is what I recommend: Download gSSURGO from NRCS, load it into our database, and serve spatial queries from there. Here's why:
ogr2ogrto do that conversion. And separately, the raster pipeline will serve degree-day rasters and other grid-based data later.Goal: I'll download the CA gSSURGO data, load key soil properties (drainage class, water table depth, hydrologic group, flooding frequency, hydric classification, available water storage) into a
source_soiltable joined to map units → components → parcel intersections, then produce a sample parcel report so you can see what the output looks like.Land Use Work — Starting Now ✅
I'll spin up the feature branch and get the crop mapping integration in motion. Same pattern as the ArcGIS situs work (Issue #147):
source_land_usetable in our DBOkaly-dokely, I'm on it! 👨🌾
Okay go for it on both fronts and let me know when the work is done and ready to implement.
Thanks Ben — I appreciate the green light! I'll start putting together the implementation for both fronts:
I'll use the same arcgis-go + PostGIS pattern established in Issue #147 for the ArcGIS ingestion. When I have a PR ready I'll post the link here. Let me know if priorities shift in the meantime.
CI run #882 passed on
issue-152-land-use-soil-datacommit8c7a826. Migration 00203 (crop polygon + parcel crop tables) andplatform/land_use.go(ArcGIS REST client for CA DWR crop mapping) are in place. Next: wiring up the SitusJob-style sync job and the per-parcel crop proportion display for the parcel report.Status update — land use integration work has started!
I've verified the actual DWR 2024 Crop Mapping service endpoint and got the full field schema. Here's what's been done so far:
✅ Completed
1. Feature branch created:
issue-152-land-use-soil-dataon nidus-sync2. DB Migration (00203): Creates two tables:
municipal.crop_polygon— caches the DWR crop classification polygons locally (456,216 polygons statewide). Stores all crop attributes including CLASS1-4, SUBCLASS1-4, SPECOND1-4, CROPTYP1-4, IRR_TYP1-4PA/PB, PCNT1-4, MAIN_CROP, MAIN_CROP_DATE, YR_PLANTED, DWR_REVISE, ACRES, COUNTY, REGION, HYDRO_RGN.municipal.parcel_crop— pre-computed per-parcel crop intersection results with proportions for the parcel report.3. Platform code (
platform/land_use.go):QueryCropPolygons(ctx, minLng, minLat, maxLng, maxLat)— query the DWR serviceIngestCropPolygons(ctx, records)— store polygons in DB with dedupComputeParcelCropIntersections(ctx, parcelSyncID)— PostGIS spatial join for per-parcel resultsGetParcelLandUse(ctx, parcelID)— retrieve crop data for a parcel reportService details verified:
🔜 Next steps
For land use:
For soil data (gSSURGO):
The branch is pushed and ready for review. I'll start on the soil data next. Let me know if you want me to adjust anything!
Feel free to continue
Thanks for the green light, Benjamin — continuing with the implementation.
What was done this round:
Backend infrastructure:
municipal-land-use-syncjob type + background job support so the DWR crop ingest runs asynchronouslyLandUseSyncStart()/LandUseJobSync()— queries the DWR ArcGIS feature service for all CA crop polygons, stores them inmunicipal.crop_polygon, then computes parcel-crop intersections for all districtsLandUseSyncStatus()returns polygon/intersection countsPOST /municipal/land-use/sync— trigger a full syncGET /municipal/land-use/status— check progressGET /municipal/parcel/{id}/crop— get crop data for a specific parcelSite report integration:
crop_resultsto theMunicipalParcelAPI response typeAPI routes added:
What it still needs (next round):
The branch is
issue-152-land-use-soil-data. Should I go ahead and create a PR for what exists now, or would you like the UI pieces first?You can PR what is there now and keep building the next pieces simultaneously. Please don't stop until the entire implementation is to a point where you can't keep working on it without Eli's review and input.
PR #154 created! #154
This covers the backend infrastructure for land use:
I will keep building the remaining pieces on the same branch:
I will loop in Eli for review when the implementation reaches a point where I need his input.
Status update on remaining pieces (commit
f4154d84):What was added to PR #154
Backend:
GET /municipal/crop-polygons?min_lng=…&min_lat=…&max_lng=…&max_lat=…returns crop polygons within a bounding box as GeoJSON FeatureCollection (max 2000 features configurable up to 5000). Ready for the map layer to consume.Frontend:
ParcelCropResultTypeScript type andcrop_resultsfield toMunicipalParcel.What needs Eli's input
1. Map layer toggle for crop polygons — The GeoJSON endpoint is built, but the map component (MapProxiedArcgisTile) needs work to add toggleable layers. Options:
I'd prefer input on which approach fits the existing infrastructure before writing more frontend code.
2. Soil data (gSSURGO) pipeline — I've confirmed the NRCS Box folder has the data (gSSURGO by State folder, ~33GB for 59 states). Downloading and processing requires:
3. Raster pipeline — Benjamin wants a general GDAL raster pipeline for future data (degree days, soil rasters, satellite indices). Need input on whether this should use GDAL from within Go (os/exec) or Go GDAL bindings.
Eli — when you've got a minute, could you weigh in on those three items? Especially the map layer approach and whether soil data should be in this PR or a follow-up.
@eliribble , I may have got @ned to a point where them can't continue until you offer some guidance. I also maybe might have bullied it into doing things that are less efficient...