Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fastapi>=0.110.0
geojson
httpx
jwcrypto
libhxl
numpy>=1.22.2
openpyxl
parse-accept-language
Expand Down
147 changes: 147 additions & 0 deletions spp_gis_indicators/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

======================
OpenSPP GIS Indicators
======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3e0d3c935187c1430aaa36bc854f98fde0d3ffa19bf8bafb7b342ebb706da310
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OpenSPP%2FOpenSPP2-lightgray.png?logo=github
:target: https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_gis_indicators
:alt: OpenSPP/OpenSPP2

|badge1| |badge2| |badge3|

Choropleth visualization for area-level indicators on GIS maps. Maps
indicator values from CEL variables to colors using configurable
classification methods and ColorBrewer-based color scales. Supports
quantile, equal interval, and manual break classification with automatic
legend generation.

Key Capabilities
~~~~~~~~~~~~~~~~

- Define indicator layer configurations that link CEL variables to color
scales and classification methods
- Classify continuous indicator values into discrete color classes using
quantile, equal interval, or manual breaks
- Apply preset ColorBrewer color scales (sequential, diverging,
categorical) or define custom scales
- Compute break values automatically based on actual data distribution
- Generate HTML legends showing color-to-value mappings
- Map area features to colors for choropleth rendering in GIS data
layers
- Filter indicators by period and hazard incident context

Key Models
~~~~~~~~~~

+-----------------------------+----------------------------------------+
| Model | Description |
+=============================+========================================+
| ``spp.gis.indicator.layer`` | Configuration linking a CEL variable |
| | to color scale and classification |
| | settings |
+-----------------------------+----------------------------------------+
| ``spp.gis.color.scale`` | Color scheme definition with JSON |
| | array of hex colors |
+-----------------------------+----------------------------------------+
| ``spp.gis.data.layer`` | Extended with ``choropleth`` geo |
| | representation option |
+-----------------------------+----------------------------------------+

Configuration
~~~~~~~~~~~~~

After installing:

1. Navigate to **Settings > GIS Configuration > Color Scales**
2. Review preset ColorBrewer scales (Blues, Greens, Red-Yellow-Green,
etc.) or create custom scales
3. Navigate to **Settings > GIS Configuration > Indicator Layers**
4. Create an indicator layer specifying the CEL variable, period key,
color scale, and classification method
5. In an existing GIS data layer, set ``geo_repr`` to ``choropleth`` and
select the indicator layer to visualize

UI Location
~~~~~~~~~~~

- **Menu**: Settings > GIS Configuration > Indicator Layers
- **Menu**: Settings > GIS Configuration > Color Scales

Security
~~~~~~~~

================================== =============================
Group Access
================================== =============================
``spp_security.group_spp_user`` Read
``spp_security.group_spp_manager`` Read/write/create (no delete)
``spp_security.group_spp_admin`` Full CRUD
================================== =============================

Extension Points
~~~~~~~~~~~~~~~~

- Override ``_compute_quantile_breaks()`` or
``_compute_equal_interval_breaks()`` in ``spp.gis.indicator.layer`` to
add custom classification algorithms
- Inherit ``spp.gis.color.scale`` and override ``get_color_for_value()``
to implement custom color mapping logic
- Extend ``spp.gis.indicator.layer._get_indicator_values()`` to support
additional data sources beyond ``spp.hxl.area.indicator``

Dependencies
~~~~~~~~~~~~

``spp_gis``, ``spp_hxl_area``

.. 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 <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OpenSPP/OpenSPP2/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 <https://github.com/OpenSPP/OpenSPP2/issues/new?body=module:%20spp_gis_indicators%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* OpenSPP.org

Maintainers
-----------

This module is part of the `OpenSPP/OpenSPP2 <https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_gis_indicators>`_ project on GitHub.

You are welcome to contribute.
3 changes: 3 additions & 0 deletions spp_gis_indicators/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Part of OpenSPP. See LICENSE file for full copyright and licensing details.

from . import models
28 changes: 28 additions & 0 deletions spp_gis_indicators/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Part of OpenSPP. See LICENSE file for full copyright and licensing details.

{
"name": "OpenSPP GIS Indicators",
"summary": "Choropleth visualization for area-level indicators",
"version": "19.0.2.0.0",
"category": "OpenSPP/GIS",
"author": "OpenSPP.org",
"website": "https://github.com/OpenSPP/OpenSPP2",
"license": "LGPL-3",
"development_status": "Alpha",
"depends": [
"spp_gis",
"spp_hxl_area",
"spp_registry",
],
"data": [
"security/ir.model.access.csv",
"data/color_scales.xml",
"views/menu.xml",
"views/indicator_layer_views.xml",
"views/color_scale_views.xml",
"views/data_layer_views.xml",
],
"application": False,
"installable": True,
"auto_install": False,
}
140 changes: 140 additions & 0 deletions spp_gis_indicators/data/color_scales.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- Sequential Color Scales -->

<record id="color_scale_blues" model="spp.gis.color.scale">
<field name="name">Blues (Sequential)</field>
<field name="scale_type">sequential</field>
<field
name="colors_json"
>["#f7fbff", "#deebf7", "#c6dbef", "#9ecae1", "#6baed6", "#4292c6", "#2171b5", "#08519c", "#08306b"]</field>
<field
name="description"
>Sequential blue color scale from light to dark. Good for showing increasing values like population density or service coverage.</field>
<field name="sequence">10</field>
</record>

<record id="color_scale_greens" model="spp.gis.color.scale">
<field name="name">Greens (Sequential)</field>
<field name="scale_type">sequential</field>
<field
name="colors_json"
>["#f7fcf5", "#e5f5e0", "#c7e9c0", "#a1d99b", "#74c476", "#41ab5d", "#238b45", "#006d2c", "#00441b"]</field>
<field
name="description"
>Sequential green color scale from light to dark. Good for showing environmental or health indicators.</field>
<field name="sequence">20</field>
</record>

<record id="color_scale_reds" model="spp.gis.color.scale">
<field name="name">Reds (Sequential)</field>
<field name="scale_type">sequential</field>
<field
name="colors_json"
>["#fff5f0", "#fee0d2", "#fcbba1", "#fc9272", "#fb6a4a", "#ef3b2c", "#cb181d", "#a50f15", "#67000d"]</field>
<field
name="description"
>Sequential red color scale from light to dark. Good for showing risk, danger, or negative indicators.</field>
<field name="sequence">30</field>
</record>

<record id="color_scale_oranges" model="spp.gis.color.scale">
<field name="name">Oranges (Sequential)</field>
<field name="scale_type">sequential</field>
<field
name="colors_json"
>["#fff5eb", "#fee6ce", "#fdd0a2", "#fdae6b", "#fd8d3c", "#f16913", "#d94801", "#a63603", "#7f2704"]</field>
<field
name="description"
>Sequential orange color scale from light to dark. Good for showing moderate risk or attention areas.</field>
<field name="sequence">40</field>
</record>

<record id="color_scale_purples" model="spp.gis.color.scale">
<field name="name">Purples (Sequential)</field>
<field name="scale_type">sequential</field>
<field
name="colors_json"
>["#fcfbfd", "#efedf5", "#dadaeb", "#bcbddc", "#9e9ac8", "#807dba", "#6a51a3", "#54278f", "#3f007d"]</field>
<field
name="description"
>Sequential purple color scale from light to dark. Good for showing education or program enrollment indicators.</field>
<field name="sequence">50</field>
</record>

<!-- Diverging Color Scales -->

<record id="color_scale_rdylgn" model="spp.gis.color.scale">
<field name="name">Red-Yellow-Green (Diverging)</field>
<field name="scale_type">diverging</field>
<field
name="colors_json"
>["#d73027", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#d9ef8b", "#a6d96a", "#66bd63", "#1a9850"]</field>
<field
name="description"
>Diverging scale from red (negative) through yellow to green (positive). Good for showing progress against targets or deviations from a norm.</field>
<field name="sequence">60</field>
</record>

<record id="color_scale_rdbu" model="spp.gis.color.scale">
<field name="name">Red-Blue (Diverging)</field>
<field name="scale_type">diverging</field>
<field
name="colors_json"
>["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#d1e5f0", "#92c5de", "#4393c3", "#2166ac", "#053061"]</field>
<field
name="description"
>Diverging scale from red to blue. Good for showing opposing conditions or bidirectional change.</field>
<field name="sequence">70</field>
</record>

<record id="color_scale_spectral" model="spp.gis.color.scale">
<field name="name">Spectral (Diverging)</field>
<field name="scale_type">diverging</field>
<field
name="colors_json"
>["#9e0142", "#d53e4f", "#f46d43", "#fdae61", "#fee08b", "#e6f598", "#abdda4", "#66c2a5", "#3288bd", "#5e4fa2"]</field>
<field
name="description"
>Spectral diverging scale across the color spectrum. Good for showing complex diverging patterns.</field>
<field name="sequence">80</field>
</record>

<record id="color_scale_brbg" model="spp.gis.color.scale">
<field name="name">Brown-Green (Diverging)</field>
<field name="scale_type">diverging</field>
<field
name="colors_json"
>["#8c510a", "#bf812d", "#dfc27d", "#f6e8c3", "#f5f5f5", "#c7eae5", "#80cdc1", "#35978f", "#01665e"]</field>
<field
name="description"
>Diverging scale from brown to green. Good for environmental indicators or land use changes.</field>
<field name="sequence">90</field>
</record>

<!-- Categorical Color Scales -->

<record id="color_scale_set1" model="spp.gis.color.scale">
<field name="name">Set1 (Categorical)</field>
<field name="scale_type">categorical</field>
<field
name="colors_json"
>["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf"]</field>
<field
name="description"
>Categorical color set with distinct colors. Good for showing different types or categories.</field>
<field name="sequence">100</field>
</record>

<record id="color_scale_paired" model="spp.gis.color.scale">
<field name="name">Paired (Categorical)</field>
<field name="scale_type">categorical</field>
<field
name="colors_json"
>["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00"]</field>
<field
name="description"
>Paired categorical colors with light and dark variants. Good for comparing similar categories.</field>
<field name="sequence">110</field>
</record>
</odoo>
5 changes: 5 additions & 0 deletions spp_gis_indicators/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Part of OpenSPP. See LICENSE file for full copyright and licensing details.

from . import color_scale
from . import data_layer
from . import indicator_layer
Loading
Loading