POI-Karte: Offline-Import aus OSM statt Live-Overpass-Scan (Build 4)
- osm.py: Live-Scanner deaktiviert — /pois liest nur noch aus DB, /analyze ist No-Op. Behebt wiederholte OSM-Banns (Tile-Load + Scanning). - tools/osm-extract: Extraktion (pyosmium) + Loader (schützt user_edited) + Docker-Refresh-Job mit osmium-tags-filter-Vorstufe (RAM-schonend). - docker-compose.osm.yml: Refresh-Service (mem_limit 4g), monatlich via DSM-Aufgabenplaner.
This commit is contained in:
parent
214543559c
commit
4bc7454258
9 changed files with 457 additions and 26 deletions
|
|
@ -1,6 +1,11 @@
|
|||
"""
|
||||
BAN YARO — OSM/Overpass POI-Cache + Community-Pins
|
||||
Cacht OSM-Daten lokal, erlaubt Nutzern eigene Marker und Meldungen.
|
||||
BAN YARO — OSM POI-Daten + Community-Pins
|
||||
Liest OSM-POIs aus der lokalen Tabelle osm_pois (monatlicher Offline-Import,
|
||||
tools/osm-extract/), erlaubt Nutzern eigene Marker und Meldungen.
|
||||
|
||||
Build 4: Live-Scannen gegen overpass-api.de ist DEAKTIVIERT (war Bann-Quelle).
|
||||
Die Overpass-Hilfsfunktionen unten sind ungenutzt und können später entfernt
|
||||
werden. /geocode nutzt weiterhin Nominatim für die Adresssuche (geringe Last).
|
||||
"""
|
||||
|
||||
import math
|
||||
|
|
@ -191,17 +196,9 @@ async def get_pois(
|
|||
fetched_fresh = False
|
||||
|
||||
if type in OSM_QUERIES:
|
||||
tiles = _covering_tiles(south, west, north, east, CACHE_ZOOM)
|
||||
stale = _stale_tiles(type, tiles)
|
||||
|
||||
if stale and not fast:
|
||||
async def _bg_fetch(poi_type, stale_tiles):
|
||||
for (x, y) in stale_tiles:
|
||||
await _fetch_and_store_tile(poi_type, x, y)
|
||||
task = asyncio.create_task(_bg_fetch(type, stale))
|
||||
_bg_tasks.add(task)
|
||||
task.add_done_callback(_bg_tasks.discard)
|
||||
|
||||
# Scanner deaktiviert (Build 4): keine Live-Overpass-Abfragen mehr.
|
||||
# POIs stammen aus dem monatlichen Offline-Import in die Tabelle
|
||||
# osm_pois (tools/osm-extract/). Hier wird nur noch daraus gelesen.
|
||||
with db() as conn:
|
||||
reported = {
|
||||
row[0] for row in conn.execute(
|
||||
|
|
@ -364,24 +361,17 @@ async def report_poi(body: ReportIn, user = Depends(get_current_user)):
|
|||
# ------------------------------------------------------------------
|
||||
@router.post('/analyze')
|
||||
async def analyze_region(
|
||||
background_tasks: BackgroundTasks,
|
||||
south: float = Query(...),
|
||||
west: float = Query(...),
|
||||
north: float = Query(...),
|
||||
east: float = Query(...),
|
||||
):
|
||||
tiles = _covering_tiles(south, west, north, east, CACHE_ZOOM)
|
||||
|
||||
async def _warmup():
|
||||
tasks = [
|
||||
_fetch_and_store_tile(pt, x, y)
|
||||
for pt in OSM_QUERIES
|
||||
for (x, y) in _stale_tiles(pt, tiles)
|
||||
]
|
||||
await asyncio.gather(*tasks)
|
||||
|
||||
background_tasks.add_task(_warmup)
|
||||
return {'status': 'gestartet', 'tiles': len(tiles), 'types': list(OSM_QUERIES.keys())}
|
||||
# Scanner deaktiviert (Build 4): kein Live-Overpass-Warmup mehr. POIs
|
||||
# kommen aus dem monatlichen Offline-Import (tools/osm-extract/). Endpoint
|
||||
# bleibt als No-Op erhalten, damit bestehende Frontends nicht 404 laufen.
|
||||
return {'status': 'offline-import',
|
||||
'message': 'POIs werden monatlich offline importiert — kein Live-Scan nötig.',
|
||||
'types': list(OSM_QUERIES.keys())}
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue