Skip to content

Commit

Permalink
feat: log capture-area generation duration TDE-1080 (#889)
Browse files Browse the repository at this point in the history
* feat: log capture-area generation duration TDE-1080

* fix: use trace when capturing performance data
  • Loading branch information
paulfouquet authored Mar 6, 2024
1 parent 9868072 commit 5fd8f65
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/stac/imagery/capture_area.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import json
from typing import Any, Dict, List

from linz_logger import get_log
from shapely import BufferCapStyle, BufferJoinStyle, Geometry, to_geojson, union_all
from shapely.geometry import Polygon

from scripts.logging.time_helper import time_in_ms

DECIMAL_DEGREES_1M = 0.00001
"""
Degree precision of ~1m (decimal places 5, https://en.wikipedia.org/wiki/Decimal_degrees)
Expand Down Expand Up @@ -95,6 +98,14 @@ def generate_capture_area(polygons: List[Polygon], gsd: float) -> Dict[str, Any]
Returns:
The capture-area geojson document.
"""
start_time = time_in_ms()
get_log().trace("Generating capture-area started")

merged_polygons = merge_polygons(polygons, get_buffer_distance(gsd))

get_log().trace(
"Generating capture-area ended",
duration=time_in_ms() - start_time,
)

return to_feature(merged_polygons)

0 comments on commit 5fd8f65

Please sign in to comment.