fix(api): /parcels/by-bbox 500 — area via ST_Area, drop missing land_category #347

Merged
lekss361 merged 1 commit from fix/by-bbox-cad-parcels-missing-cols into main 2026-05-17 23:09:19 +00:00

1 commit

Author SHA1 Message Date
lekss361
2dd21f68b3 fix(api): /parcels/by-bbox — derive area_m2 via ST_Area + drop missing land_category
P0 prod 500 (GlitchTip backend, deploy #135+ on main): endpoint queried
cad_parcels.area_m2 and cad_parcels.land_category, but the table only has
(cad_num, geom). PR #336 (SF-B1) shipped with wrong column assumption.

Repro:
  curl 'https://gendsgn.ru/api/v1/parcels/by-bbox?min_lat=...&min_lon=...' -> 500
  ProgrammingError: column p.area_m2 does not exist

Fix: compute area from geometry via ST_Area(p.geom::geography) (meter accuracy
on a geography cast), return NULL::text for land_category until EGRN enrichment
is wired (tracking: B5 EGRN contract follow-up).

Verified inline through postgres MCP: SQL returns expected rows
(66:41:0001001:18 area 2945931 m^2, etc.) on production schema.
2026-05-18 02:06:08 +03:00