mirror of
https://github.com/zvx-echo6/recon.git
synced 2026-05-20 06:34:40 +02:00
Add TomTom traffic proxy and update profiles for hillshade/traffic layers
- Add /api/traffic/flow proxy route to hide TomTom API key from frontend - Add tileset_hillshade and traffic config blocks to all three profiles - Flip has_hillshade and has_traffic_overlay flags in home and regional profiles - Minimal profile has config blocks but flags remain false (dormant) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e6b81db520
commit
64605b38bb
4 changed files with 51 additions and 4 deletions
|
|
@ -11,6 +11,15 @@ tileset:
|
||||||
max_zoom: 15
|
max_zoom: 15
|
||||||
attribution: "Protomaps © OSM"
|
attribution: "Protomaps © OSM"
|
||||||
|
|
||||||
|
tileset_hillshade:
|
||||||
|
url: "/tiles/hillshade-na.pmtiles"
|
||||||
|
encoding: "terrarium"
|
||||||
|
max_zoom: 12
|
||||||
|
|
||||||
|
traffic:
|
||||||
|
provider: "tomtom"
|
||||||
|
proxy_url: "/api/traffic/flow/{z}/{x}/{y}.png"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
geocode: "/api/geocode"
|
geocode: "/api/geocode"
|
||||||
reverse: "/api/reverse"
|
reverse: "/api/reverse"
|
||||||
|
|
@ -20,9 +29,9 @@ services:
|
||||||
features:
|
features:
|
||||||
has_nominatim_details: false
|
has_nominatim_details: false
|
||||||
has_kiwix_wiki: false
|
has_kiwix_wiki: false
|
||||||
has_hillshade: false
|
has_hillshade: true
|
||||||
has_3d_terrain: false
|
has_3d_terrain: false
|
||||||
has_traffic_overlay: false
|
has_traffic_overlay: true
|
||||||
has_landclass: false
|
has_landclass: false
|
||||||
has_address_book_write: false
|
has_address_book_write: false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,15 @@ tileset:
|
||||||
max_zoom: 15
|
max_zoom: 15
|
||||||
attribution: "Protomaps © OSM"
|
attribution: "Protomaps © OSM"
|
||||||
|
|
||||||
|
tileset_hillshade:
|
||||||
|
url: "/tiles/hillshade-idaho.pmtiles"
|
||||||
|
encoding: "terrarium"
|
||||||
|
max_zoom: 12
|
||||||
|
|
||||||
|
traffic:
|
||||||
|
provider: "tomtom"
|
||||||
|
proxy_url: "/api/traffic/flow/{z}/{x}/{y}.png"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
geocode: "/api/geocode"
|
geocode: "/api/geocode"
|
||||||
reverse: "/api/reverse"
|
reverse: "/api/reverse"
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,15 @@ tileset:
|
||||||
max_zoom: 15
|
max_zoom: 15
|
||||||
attribution: "Protomaps © OSM"
|
attribution: "Protomaps © OSM"
|
||||||
|
|
||||||
|
tileset_hillshade:
|
||||||
|
url: "/tiles/hillshade-regional.pmtiles"
|
||||||
|
encoding: "terrarium"
|
||||||
|
max_zoom: 12
|
||||||
|
|
||||||
|
traffic:
|
||||||
|
provider: "tomtom"
|
||||||
|
proxy_url: "/api/traffic/flow/{z}/{x}/{y}.png"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
geocode: "/api/geocode"
|
geocode: "/api/geocode"
|
||||||
reverse: "/api/reverse"
|
reverse: "/api/reverse"
|
||||||
|
|
@ -22,7 +31,7 @@ features:
|
||||||
has_kiwix_wiki: false
|
has_kiwix_wiki: false
|
||||||
has_hillshade: true
|
has_hillshade: true
|
||||||
has_3d_terrain: false
|
has_3d_terrain: false
|
||||||
has_traffic_overlay: false
|
has_traffic_overlay: true
|
||||||
has_landclass: true
|
has_landclass: true
|
||||||
has_address_book_write: true
|
has_address_book_write: true
|
||||||
|
|
||||||
|
|
|
||||||
22
lib/api.py
22
lib/api.py
|
|
@ -17,7 +17,7 @@ import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import requests as http_requests
|
import requests as http_requests
|
||||||
from flask import Flask, request, jsonify, redirect, render_template
|
from flask import Flask, request, jsonify, redirect, render_template, make_response
|
||||||
from qdrant_client import QdrantClient
|
from qdrant_client import QdrantClient
|
||||||
from qdrant_client.models import Filter, FieldCondition, MatchValue
|
from qdrant_client.models import Filter, FieldCondition, MatchValue
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
|
|
@ -1166,6 +1166,26 @@ def api_knowledge_stats():
|
||||||
return jsonify(_cache['knowledge_stats'])
|
return jsonify(_cache['knowledge_stats'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/api/traffic/flow/<int:z>/<int:x>/<int:y>.png')
|
||||||
|
def api_traffic_flow(z, x, y):
|
||||||
|
"""Proxy TomTom traffic flow tiles to hide API key from frontend."""
|
||||||
|
key = os.environ.get('TOMTOM_API_KEY')
|
||||||
|
if not key:
|
||||||
|
return 'Traffic service not configured', 503
|
||||||
|
url = f'https://api.tomtom.com/traffic/map/4/tile/flow/relative/{z}/{x}/{y}.png?key={key}'
|
||||||
|
try:
|
||||||
|
resp = http_requests.get(url, timeout=10)
|
||||||
|
if resp.status_code != 200:
|
||||||
|
return 'Upstream error', 502
|
||||||
|
r = make_response(resp.content)
|
||||||
|
r.headers['Content-Type'] = 'image/png'
|
||||||
|
r.headers['Cache-Control'] = 'public, max-age=120'
|
||||||
|
return r
|
||||||
|
except Exception:
|
||||||
|
return 'Upstream timeout', 504
|
||||||
|
|
||||||
|
|
||||||
@app.route('/api/config')
|
@app.route('/api/config')
|
||||||
def api_config():
|
def api_config():
|
||||||
"""Return deployment profile config for frontend consumption."""
|
"""Return deployment profile config for frontend consumption."""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue