fix(cadastre): skip grid-walk for broken quarter geometries (#168)
Pilot v5 (50 quarters) разоблачил что cad_quarters_geom имеет 1735/2408 (72%) ЕКБ rows с broken micro-precision geom (width ~0.01м instead of 200-4000м). Causes: - grid-walk WMS receives bbox ~1mm × 1mm → 500 ServiceException на all 450 req - One quarter hung 2+ min (silent failure in async loop) Real fix: re-import cad_quarters_geom geometry from NSPD (category 36381). Tracked в follow-up issue. Quick fix (this PR): sanity-check quarter_bbox_3857 — return None если width ИЛИ height not in [100m, 10000m]. Bulk_harvest_quarter then skips grid-walk для broken quarters, только snapshot phase запускается (20 per cat). After this fix: - All 50 pilot quarters получают snapshot (parcels/buildings/etc up to 20 each) - Grid-walk runs only для 673/2408 healthy quarters → no 500 cascades, no hangs
This commit is contained in:
parent
6dfff5e046
commit
6d9b30625b
1 changed files with 17 additions and 1 deletions
|
|
@ -46,12 +46,28 @@ def quarter_bbox_3857(db: Session, quarter: str) -> tuple[float, float, float, f
|
|||
if not row or row["xmin"] is None:
|
||||
logger.warning("quarter_bbox_3857: квартал %s не найден в cad_quarters_geom", quarter)
|
||||
return None
|
||||
return (
|
||||
bbox = (
|
||||
float(row["xmin"]),
|
||||
float(row["ymin"]),
|
||||
float(row["xmax"]),
|
||||
float(row["ymax"]),
|
||||
)
|
||||
# Sanity check: cad_quarters_geom имеет ~72% rows с broken micro-precision
|
||||
# geometry (width <0.01m). Это вызывает useless 1px tiles в WMS и 500 errors
|
||||
# от NSPD. Реальный квартал ЕКБ имеет width 200-4000м. Skip grid-walk для
|
||||
# broken — snapshot phase даст 20 per cat, что норм для MVP.
|
||||
width = bbox[2] - bbox[0]
|
||||
height = bbox[3] - bbox[1]
|
||||
if width < 100 or height < 100 or width > 10000 or height > 10000:
|
||||
logger.warning(
|
||||
"quarter_bbox_3857: квартал %s broken geom — width=%.2fm height=%.2fm "
|
||||
"(expected 100-10000m). Grid-walk skipped, only snapshot phase.",
|
||||
quarter,
|
||||
width,
|
||||
height,
|
||||
)
|
||||
return None
|
||||
return bbox
|
||||
|
||||
|
||||
def generate_grid_click_points(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue