diff --git a/farm_field_overlays/README.rst b/farm_field_overlays/README.rst new file mode 100644 index 0000000..0625519 --- /dev/null +++ b/farm_field_overlays/README.rst @@ -0,0 +1,130 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +============================ +Farm Field — Public Overlays +============================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:a76ed9cebaf8eebcba13f4a3133301299225ea185f73b4d2e742fba77b8d9594 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-ledoent%2Ffarm--pack-lightgray.png?logo=github + :target: https://github.com/ledoent/farm-pack/tree/19.0/farm_field_overlays + :alt: ledoent/farm-pack + +|badge1| |badge2| |badge3| + +Adds three public-domain US-government overlay layers to the farm field +map: + +- **OpenStreetMap** — basemap; roads, parcels, buildings (default + visible) +- **USDA Cropland (CDL)** — current-year crop-classification raster + covering the lower 48; overlays the historical crop on a farmer's + parcels so you can see what was planted in previous years from + satellite-derived classification (50%-opacity by default) +- **NRCS SSURGO Soil** — soil mapunit polygons; click-through gives soil + type, drainage class, productivity (40%-opacity by default) + +All three are read-only: no API keys, no per-request quota, no +proprietary data. Layers are stored as ``geoengine.raster.layer`` +records bound to the field map view, so an admin can disable, reorder, +or edit the WMS endpoints via Settings → Technical → Geoengine → Raster +Layers without touching code. + +**Scope.** Read-only display only. Click-to-query (e.g. "what soil type +is under this point?") needs a ``farm_field_query`` follow-up module +that wires up GetFeatureInfo round-trips. USGS NHD (hydrography) and +Topo are deferred to a follow-up to keep this PR tight. + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +1. Open Farm → Fields → Fields and switch to the **Map** view. +2. The layer toggle (top-right of the map) lists OpenStreetMap, USDA + Cropland, and NRCS Soil. Toggle each on/off independently. +3. To customize a layer (URL, opacity, ordering): Settings → Technical → + Geoengine → Raster Layers — pick the layer, edit, save. + +**Annual update — USDA CDL.** The Cropland Data Layer is published per +crop year and the WMS layer name carries the year (e.g. ``cdl_2024``). +USDA typically publishes the new year's raster in Feb/Mar of the +following calendar year. Each January or February, update the LAYERS +param on the "USDA Cropland" raster layer record: + +1. Settings → Technical → Geoengine → Raster Layers → "USDA Cropland + (CDL …)" +2. Edit Params WMS, change ``cdl_YYYY`` to the new year +3. Update the layer's display name to match +4. Save and reload the map view + +To add another WMS overlay (e.g. USGS NHD hydrography for streams + +ponds): + +1. Settings → Technical → Geoengine → Raster Layers → New +2. Raster layer type: **Distant WMS** +3. URL: the WMS endpoint +4. Params WMS: + ``{"LAYERS": "", "FORMAT": "image/png", "TRANSPARENT": "TRUE"}`` +5. Bind to view: **farm.field.geoengine** +6. Save; reload the map view. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Ledo Enterprises + +Contributors +------------ + +- Daniel Kendall + +Maintainers +----------- + +.. |maintainer-dnplkndll| image:: https://github.com/dnplkndll.png?size=40px + :target: https://github.com/dnplkndll + :alt: dnplkndll + +Current maintainer: + +|maintainer-dnplkndll| + +This module is part of the `ledoent/farm-pack `_ project on GitHub. + +You are welcome to contribute. diff --git a/farm_field_overlays/__init__.py b/farm_field_overlays/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/farm_field_overlays/__manifest__.py b/farm_field_overlays/__manifest__.py new file mode 100644 index 0000000..bc71276 --- /dev/null +++ b/farm_field_overlays/__manifest__.py @@ -0,0 +1,21 @@ +{ + "name": "Farm Field — Public Overlays", + "version": "19.0.1.0.0", + "summary": "USDA Cropland + NRCS Soil overlays on the field map", + "author": "Ledo Enterprises, Odoo Community Association (OCA)", + "maintainers": ["dnplkndll"], + "website": "https://github.com/ledoent/farm-pack", + "license": "AGPL-3", + "category": "Vertical/Agriculture", + # Alpha matches farm_field_geo (and transitively farm_field); OCA's + # check-dev-status gate rejects higher → lower dev-status deps. + "development_status": "Alpha", + "depends": [ + "farm_field_geo", + ], + "data": [ + "data/geoengine_raster_layers.xml", + ], + "installable": True, + "application": False, +} diff --git a/farm_field_overlays/data/geoengine_raster_layers.xml b/farm_field_overlays/data/geoengine_raster_layers.xml new file mode 100644 index 0000000..03e5672 --- /dev/null +++ b/farm_field_overlays/data/geoengine_raster_layers.xml @@ -0,0 +1,58 @@ + + + + + USDA Cropland (CDL 2024) + d_wms + https://nassgeodata.gmu.edu/CropScape/wms + {"LAYERS": "cdl_2024", "FORMAT": "image/png", "TRANSPARENT": "TRUE"} + mapserver + + 0.5 + 10 + + + + + NRCS Soil (SSURGO) + d_wms + https://sdmdataaccess.nrcs.usda.gov/Spatial/SDMWGS84Geographic.wms + {"LAYERS": "MapunitPoly", "FORMAT": "image/png", "TRANSPARENT": "TRUE"} + geoserver + + 0.4 + 20 + + + + + + OpenStreetMap + osm + + 99 + + + diff --git a/farm_field_overlays/pyproject.toml b/farm_field_overlays/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/farm_field_overlays/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/farm_field_overlays/readme/CONTRIBUTORS.md b/farm_field_overlays/readme/CONTRIBUTORS.md new file mode 100644 index 0000000..c71b705 --- /dev/null +++ b/farm_field_overlays/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Daniel Kendall <dkendall@ledoweb.com> diff --git a/farm_field_overlays/readme/DESCRIPTION.md b/farm_field_overlays/readme/DESCRIPTION.md new file mode 100644 index 0000000..3097046 --- /dev/null +++ b/farm_field_overlays/readme/DESCRIPTION.md @@ -0,0 +1,19 @@ +Adds three public-domain US-government overlay layers to the farm field map: + +- **OpenStreetMap** — basemap; roads, parcels, buildings (default visible) +- **USDA Cropland (CDL)** — current-year crop-classification raster covering + the lower 48; overlays the historical crop on a farmer's parcels so you can + see what was planted in previous years from satellite-derived + classification (50%-opacity by default) +- **NRCS SSURGO Soil** — soil mapunit polygons; click-through gives soil + type, drainage class, productivity (40%-opacity by default) + +All three are read-only: no API keys, no per-request quota, no proprietary +data. Layers are stored as `geoengine.raster.layer` records bound to the +field map view, so an admin can disable, reorder, or edit the WMS endpoints +via Settings → Technical → Geoengine → Raster Layers without touching code. + +**Scope.** Read-only display only. Click-to-query (e.g. "what soil type is +under this point?") needs a `farm_field_query` follow-up module that wires +up GetFeatureInfo round-trips. USGS NHD (hydrography) and Topo are deferred +to a follow-up to keep this PR tight. diff --git a/farm_field_overlays/readme/USAGE.md b/farm_field_overlays/readme/USAGE.md new file mode 100644 index 0000000..fe75325 --- /dev/null +++ b/farm_field_overlays/readme/USAGE.md @@ -0,0 +1,25 @@ +1. Open Farm → Fields → Fields and switch to the **Map** view. +2. The layer toggle (top-right of the map) lists OpenStreetMap, USDA Cropland, + and NRCS Soil. Toggle each on/off independently. +3. To customize a layer (URL, opacity, ordering): Settings → Technical → + Geoengine → Raster Layers — pick the layer, edit, save. + +**Annual update — USDA CDL.** The Cropland Data Layer is published per +crop year and the WMS layer name carries the year (e.g. `cdl_2024`). +USDA typically publishes the new year's raster in Feb/Mar of the following +calendar year. Each January or February, update the LAYERS param on the +"USDA Cropland" raster layer record: + +1. Settings → Technical → Geoengine → Raster Layers → "USDA Cropland (CDL …)" +2. Edit Params WMS, change `cdl_YYYY` to the new year +3. Update the layer's display name to match +4. Save and reload the map view + +To add another WMS overlay (e.g. USGS NHD hydrography for streams + ponds): + +1. Settings → Technical → Geoengine → Raster Layers → New +2. Raster layer type: **Distant WMS** +3. URL: the WMS endpoint +4. Params WMS: `{"LAYERS": "", "FORMAT": "image/png", "TRANSPARENT": "TRUE"}` +5. Bind to view: **farm.field.geoengine** +6. Save; reload the map view. diff --git a/farm_field_overlays/readme/newsfragments/.gitkeep b/farm_field_overlays/readme/newsfragments/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/farm_field_overlays/static/description/index.html b/farm_field_overlays/static/description/index.html new file mode 100644 index 0000000..9f97331 --- /dev/null +++ b/farm_field_overlays/static/description/index.html @@ -0,0 +1,484 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Farm Field — Public Overlays

+ +

Alpha License: AGPL-3 ledoent/farm-pack

+

Adds three public-domain US-government overlay layers to the farm field +map:

+
    +
  • OpenStreetMap — basemap; roads, parcels, buildings (default +visible)
  • +
  • USDA Cropland (CDL) — current-year crop-classification raster +covering the lower 48; overlays the historical crop on a farmer’s +parcels so you can see what was planted in previous years from +satellite-derived classification (50%-opacity by default)
  • +
  • NRCS SSURGO Soil — soil mapunit polygons; click-through gives soil +type, drainage class, productivity (40%-opacity by default)
  • +
+

All three are read-only: no API keys, no per-request quota, no +proprietary data. Layers are stored as geoengine.raster.layer +records bound to the field map view, so an admin can disable, reorder, +or edit the WMS endpoints via Settings → Technical → Geoengine → Raster +Layers without touching code.

+

Scope. Read-only display only. Click-to-query (e.g. “what soil type +is under this point?”) needs a farm_field_query follow-up module +that wires up GetFeatureInfo round-trips. USGS NHD (hydrography) and +Topo are deferred to a follow-up to keep this PR tight.

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Usage

+
    +
  1. Open Farm → Fields → Fields and switch to the Map view.
  2. +
  3. The layer toggle (top-right of the map) lists OpenStreetMap, USDA +Cropland, and NRCS Soil. Toggle each on/off independently.
  4. +
  5. To customize a layer (URL, opacity, ordering): Settings → Technical → +Geoengine → Raster Layers — pick the layer, edit, save.
  6. +
+

Annual update — USDA CDL. The Cropland Data Layer is published per +crop year and the WMS layer name carries the year (e.g. cdl_2024). +USDA typically publishes the new year’s raster in Feb/Mar of the +following calendar year. Each January or February, update the LAYERS +param on the “USDA Cropland” raster layer record:

+
    +
  1. Settings → Technical → Geoengine → Raster Layers → “USDA Cropland +(CDL …)”
  2. +
  3. Edit Params WMS, change cdl_YYYY to the new year
  4. +
  5. Update the layer’s display name to match
  6. +
  7. Save and reload the map view
  8. +
+

To add another WMS overlay (e.g. USGS NHD hydrography for streams + +ponds):

+
    +
  1. Settings → Technical → Geoengine → Raster Layers → New
  2. +
  3. Raster layer type: Distant WMS
  4. +
  5. URL: the WMS endpoint
  6. +
  7. Params WMS: +{"LAYERS": "<layer-name>", "FORMAT": "image/png", "TRANSPARENT": "TRUE"}
  8. +
  9. Bind to view: farm.field.geoengine
  10. +
  11. Save; reload the map view.
  12. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Ledo Enterprises
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

Current maintainer:

+

dnplkndll

+

This module is part of the ledoent/farm-pack project on GitHub.

+

You are welcome to contribute.

+
+
+
+
+ + diff --git a/farm_field_overlays/tests/__init__.py b/farm_field_overlays/tests/__init__.py new file mode 100644 index 0000000..f25c4a7 --- /dev/null +++ b/farm_field_overlays/tests/__init__.py @@ -0,0 +1 @@ +from . import test_farm_field_overlays diff --git a/farm_field_overlays/tests/test_farm_field_overlays.py b/farm_field_overlays/tests/test_farm_field_overlays.py new file mode 100644 index 0000000..36c0d9b --- /dev/null +++ b/farm_field_overlays/tests/test_farm_field_overlays.py @@ -0,0 +1,38 @@ +from odoo.tests.common import TransactionCase + + +class TestFarmFieldOverlays(TransactionCase): + """Smoke-check the three overlay records ship correctly bound to the + farm.field geoengine view. Catches XML-ref breakage if either the + raster layer model or the view xmlid moves under us. + """ + + def test_overlays_are_bound_to_field_geoengine_view(self): + view = self.env.ref("farm_field_geo.farm_field_view_geoengine") + for xmlid in ( + "farm_field_overlays.farm_field_overlay_cdl", + "farm_field_overlays.farm_field_overlay_ssurgo", + "farm_field_overlays.farm_field_overlay_osm", + ): + layer = self.env.ref(xmlid) + self.assertEqual( + layer.view_id, view, f"{xmlid} should be bound to the field map" + ) + + def test_wms_overlays_carry_layer_param(self): + # Both WMS records must specify a LAYERS param — without it the WMS + # GetMap request returns a 400 and the overlay silently fails. + for xmlid in ( + "farm_field_overlays.farm_field_overlay_cdl", + "farm_field_overlays.farm_field_overlay_ssurgo", + ): + layer = self.env.ref(xmlid) + self.assertEqual(layer.raster_type, "d_wms") + self.assertIn("LAYERS", layer.params_wms or "") + + def test_osm_basemap_is_not_an_overlay(self): + # OSM sits underneath as a basemap; overlay=False keeps it from + # blanking out the WMS layers above it. + osm = self.env.ref("farm_field_overlays.farm_field_overlay_osm") + self.assertEqual(osm.raster_type, "osm") + self.assertFalse(osm.overlay)