perf: simplify WFIGS perimeter geometry at query time
Ask ArcGIS for 500 features, 5-decimal precision, and ~250m offset so fire rings are outlines instead of tens of thousands of vertices.
This commit is contained in:
parent
fdd59052c5
commit
9c14b899ee
2 changed files with 15 additions and 2 deletions
|
|
@ -597,12 +597,14 @@ async def upsert_vessel(marker: dict) -> None:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _wfigs_params(bbox: str | None) -> dict:
|
def _wfigs_params(bbox: str | None, *, offset_m: float = 250.0) -> dict:
|
||||||
params = {
|
params = {
|
||||||
"where": "1=1",
|
"where": "1=1",
|
||||||
"outSR": "4326",
|
"outSR": "4326",
|
||||||
"f": "geojson",
|
"f": "geojson",
|
||||||
"resultRecordCount": 2000,
|
"resultRecordCount": 500,
|
||||||
|
"maxAllowableOffset": offset_m / 111_320.0, # metres → degrees
|
||||||
|
"geometryPrecision": 5,
|
||||||
}
|
}
|
||||||
if bbox:
|
if bbox:
|
||||||
minlon, minlat, maxlon, maxlat = quantize_bbox(*parse_bbox(bbox))
|
minlon, minlat, maxlon, maxlat = quantize_bbox(*parse_bbox(bbox))
|
||||||
|
|
|
||||||
|
|
@ -351,3 +351,14 @@ def test_slim_alert_properties_keeps_popup_fields_only():
|
||||||
"wfo": "RAH",
|
"wfo": "RAH",
|
||||||
"source": "nws",
|
"source": "nws",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def test_wfigs_params_requests_simplified_geometry():
|
||||||
|
params = _wfigs_params("-84.5,33.8,-75.4,36.6")
|
||||||
|
assert "maxAllowableOffset" in params
|
||||||
|
assert float(params["maxAllowableOffset"]) > 0
|
||||||
|
assert params["geometryPrecision"] == 5
|
||||||
|
assert int(params["resultRecordCount"]) <= 500
|
||||||
|
# Envelope is the quantized cell, not the raw pan box.
|
||||||
|
geom = params["geometry"]
|
||||||
|
assert geom != "-84.5,33.8,-75.4,36.6"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue