mirror of
https://github.com/zvx-echo6/recon.git
synced 2026-05-20 06:34:40 +02:00
Add PAD-US public land classification lookup
Integrates USGS PAD-US 4.0 (651k features) into a local PostGIS database for point-in-polygon land ownership queries. Adds /api/landclass endpoint returning classifications, public/private status, and management hierarchy. - lib/landclass.py: connection pool, lookup_landclass(), domain label maps - lib/api.py: GET /api/landclass?lat=&lon= (feature-flag gated) - home.yaml: enable has_landclass flag Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3280e34718
commit
9c5b0520f9
3 changed files with 287 additions and 1 deletions
34
lib/api.py
34
lib/api.py
|
|
@ -26,6 +26,7 @@ from .utils import get_config, content_hash, clean_filename_to_title, derive_sou
|
|||
from .status import StatusDB
|
||||
from .deployment_config import get_deployment_config
|
||||
from .place_detail import get_place_detail
|
||||
from .landclass import lookup_landclass, format_summary
|
||||
|
||||
logger = setup_logging('recon.api')
|
||||
|
||||
|
|
@ -1234,6 +1235,39 @@ def api_place_detail(osm_type, osm_id):
|
|||
return jsonify(result), status
|
||||
|
||||
|
||||
|
||||
@app.route('/api/landclass')
|
||||
def api_landclass():
|
||||
"""PAD-US land classification lookup for a point."""
|
||||
config = get_deployment_config()
|
||||
if not config.get('features', {}).get('has_landclass'):
|
||||
return jsonify({'error': 'Land classification not available'}), 404
|
||||
|
||||
try:
|
||||
lat = float(request.args.get('lat', ''))
|
||||
lon = float(request.args.get('lon', ''))
|
||||
except (ValueError, TypeError):
|
||||
return jsonify({'error': 'lat and lon required as numbers'}), 400
|
||||
|
||||
if not (-90 <= lat <= 90) or not (-180 <= lon <= 180):
|
||||
return jsonify({'error': 'lat must be -90..90, lon must be -180..180'}), 400
|
||||
|
||||
classifications = lookup_landclass(lat, lon)
|
||||
is_public = len(classifications) > 0
|
||||
is_private = len(classifications) == 0
|
||||
summary = format_summary(classifications)
|
||||
|
||||
return jsonify({
|
||||
'lat': lat,
|
||||
'lon': lon,
|
||||
'classifications': classifications,
|
||||
'count': len(classifications),
|
||||
'is_public': is_public,
|
||||
'is_private': is_private,
|
||||
'summary': summary,
|
||||
})
|
||||
|
||||
|
||||
@app.route('/api/config')
|
||||
def api_config():
|
||||
"""Return deployment profile config for frontend consumption."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue