Skip to content

Commit

Permalink
Conditional render option and HAG colormap (#94)
Browse files Browse the repository at this point in the history
* Add conditions on mosaic info render options
* Add lidar hag alternative colormap
  • Loading branch information
mmcfarland authored May 18, 2022
1 parent ade23b3 commit f23bf0d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pccommon/pccommon/config/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,22 @@ class LegendConfig(CamelModel):
scale_factor: Optional[float]


class RenderOptionCondition(CamelModel):
"""
Defines a property/value condition for a render config to be enabled
Attributes
----------
property:
The property to check.
value:
The value to check against.
"""

property: str
value: Any


class RenderOptions(CamelModel):
"""
Defines a set of map-tile render options for a collection.
Expand All @@ -158,13 +174,17 @@ class RenderOptions(CamelModel):
Zoom level at which to start rendering the layer.
legend:
An optional legend configuration.
conditions:
A list of property/value conditions that must be in the active mosaic
CQL for this render option to be enabled
"""

name: str
description: Optional[str] = None
options: str
min_zoom: int
legend: Optional[LegendConfig] = None
conditions: Optional[List[RenderOptionCondition]] = None


class DefaultLocation(CamelModel):
Expand Down
1 change: 1 addition & 0 deletions pccommon/tests/config/test_mosaic_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test_parse() -> None:
"description": "Elevation...",
"options": "assets=data&rescale=-1000,4000&colormap_name=terrain",
"minZoom": 8,
"conditions": [{"property": "mode", "value": "Q"}],
},
{
"name": "Elevation (viridis)",
Expand Down
18 changes: 18 additions & 0 deletions pctiler/pctiler/colormaps/lidarusgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@
((6, 7), (10, 84, 158, 255)),
((7, 100), (8, 48, 107, 255)),
],
"lidar-hag-alternative": [
((-900, 0), (0, 0, 0, 0)),
((0, 1), (11, 44, 122, 255)),
((1, 2), (19, 87, 133, 255)),
((2, 4), (26, 129, 143, 255)),
((4, 6), (31, 156, 137, 255)),
((6, 8), (22, 181, 104, 255)),
((8, 10), (10, 204, 46, 255)),
((10, 12), (33, 222, 0, 255)),
((12, 14), (123, 237, 0, 255)),
((14, 16), (221, 250, 0, 255)),
((16, 18), (250, 229, 5, 255)),
((18, 20), (242, 192, 12, 255)),
((20, 22), (237, 164, 19, 255)),
((22, 25), (224, 129, 34, 255)),
((25, 30), (209, 102, 48, 255)),
((30, 100), (194, 82, 60, 255)),
],
"lidar-intensity": [
((-900, 1), (0, 0, 0, 0)),
((1, 2), (16, 16, 16, 255)),
Expand Down

0 comments on commit f23bf0d

Please sign in to comment.