feat: implement billing, usage tracking, and administrative geocoding features in API with infrastructure updates
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
# GraphHopper الرسمي — بديل صورة israelhikingmap التي تتجاهل oneway/roundabout للسيارات
|
||||
FROM eclipse-temurin:21-jre-alpine
|
||||
|
||||
RUN apk add --no-cache curl
|
||||
|
||||
WORKDIR /graphhopper
|
||||
|
||||
ARG GH_VERSION=11.0
|
||||
RUN curl -fL "https://github.com/graphhopper/graphhopper/releases/download/${GH_VERSION}/graphhopper-web-${GH_VERSION}.jar" \
|
||||
-o graphhopper-web.jar
|
||||
|
||||
EXPOSE 8080 8081
|
||||
|
||||
# sh -c ضروري لتمرير JAVA_OPTS فعلياً (الصورة القديمة كانت تتجاهله)
|
||||
ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar /graphhopper/graphhopper-web.jar \"$@\"", "--"]
|
||||
CMD ["server", "/graphhopper/config.yml"]
|
||||
@@ -19,7 +19,8 @@ graphhopper:
|
||||
import.osm.ignored_highways: "footway,cycleway,path,pedestrian,steps"
|
||||
|
||||
# قائمة واحدة بلا مسافات — GraphHopper يفصل على الفاصلة فقط
|
||||
graph.encoded_values: road_class,road_environment,max_speed,road_access,surface,roundabout,lanes
|
||||
# car_access إلزامية لأن custom_model يستخدمها لفرض اتجاه السير (انظر priority أدناه)
|
||||
graph.encoded_values: road_class,road_environment,max_speed,road_access,surface,roundabout,lanes,car_access
|
||||
|
||||
profiles:
|
||||
- name: car
|
||||
@@ -49,6 +50,11 @@ graphhopper:
|
||||
- if: "road_class == LIVING_STREET || road_class == SERVICE"
|
||||
limit_to: 14
|
||||
priority:
|
||||
# فرض اتجاه السير: بدون هذه القاعدة تبقى car_access مخزّنة في الغراف
|
||||
# لكن غير مُطبَّقة في حساب الوزن، فيُخترق كل oneway. القاعدة تأتي
|
||||
# افتراضياً من car.json، ولا تُدمج حين يُكتب custom_model سطرياً.
|
||||
- if: "!car_access"
|
||||
multiply_by: 0
|
||||
# تفضيل الشرايين الرئيسية بدل قصّ الطريق عبر الأحياء
|
||||
- if: "road_class == LIVING_STREET"
|
||||
multiply_by: 0.5
|
||||
|
||||
@@ -30,12 +30,13 @@ docker compose exec -T db psql -U mapuser -d mapdb -t -A -X > "${DELTA_OSM}" 2>/
|
||||
WITH ways AS (
|
||||
SELECT id, confidence, "uniqueDriverCount" AS drivers,
|
||||
COALESCE(highway, 'residential') AS highway,
|
||||
COALESCE(oneway, 0) AS oneway,
|
||||
start_node, end_node,
|
||||
ROW_NUMBER() OVER (ORDER BY id) AS way_seq
|
||||
FROM approved_roads
|
||||
),
|
||||
pts AS (
|
||||
SELECT w.way_seq, w.confidence, w.drivers, w.highway, w.start_node, w.end_node,
|
||||
SELECT w.way_seq, w.confidence, w.drivers, w.highway, w.oneway, w.start_node, w.end_node,
|
||||
dp.path[1] AS pt_order,
|
||||
COUNT(*) OVER (PARTITION BY w.way_seq) AS npts,
|
||||
ST_Y(dp.geom) AS lat, ST_X(dp.geom) AS lon
|
||||
@@ -64,13 +65,16 @@ nodes_xml AS (
|
||||
ways_xml AS (
|
||||
SELECT string_agg(w.x, E'\n') AS x FROM (
|
||||
SELECT format(
|
||||
' <way id="%s" version="1">%s%s%s%s%s </way>',
|
||||
' <way id="%s" version="1">%s%s%s%s%s%s </way>',
|
||||
-way_seq,
|
||||
string_agg(format(E'\n <nd ref="%s"/>', node_ref), '' ORDER BY pt_order),
|
||||
format(E'\n <tag k="highway" v="%s"/>', min(highway)),
|
||||
E'\n <tag k="source" v="intaleq:telemetry"/>',
|
||||
format(E'\n <tag k="confidence" v="%s"/>', round(min(confidence)::numeric, 2)),
|
||||
format(E'\n <tag k="intaleq:drivers" v="%s"/>\n', min(drivers))
|
||||
format(E'\n <tag k="intaleq:drivers" v="%s"/>', min(drivers)),
|
||||
CASE WHEN min(oneway) = 1 THEN E'\n <tag k="oneway" v="yes"/>'
|
||||
WHEN min(oneway) = -1 THEN E'\n <tag k="oneway" v="-1"/>'
|
||||
ELSE '' END
|
||||
) AS x
|
||||
FROM pts_ref GROUP BY way_seq
|
||||
) w
|
||||
|
||||
@@ -63,9 +63,11 @@ mv "$TMP" "$PBF"
|
||||
|
||||
# ── إعادة بناء الرسم ─────────────────────────────────────────────────────
|
||||
# GraphHopper لا يعيد قراءة الـ PBF إن كان graph-cache موجوداً.
|
||||
echo "🧹 حذف graph-cache وإعادة بناء الرسم..."
|
||||
# نحذف المجلدين: graph-cache (من إعدادنا) و default-gh (اسم GraphHopper
|
||||
# الافتراضي، وهو المستخدم فعلياً إن لم يُقرأ config.yml).
|
||||
echo "🧹 حذف الرسم المخزّن وإعادة البناء..."
|
||||
docker compose stop routing || true
|
||||
rm -rf "$DATA_DIR/graph-cache"
|
||||
rm -rf "$DATA_DIR/graph-cache" "$DATA_DIR/default-gh"
|
||||
docker compose up -d routing
|
||||
|
||||
echo "⏳ انتظار جهوزية المحرك (قد يستغرق البناء عدة دقائق)..."
|
||||
|
||||
Reference in New Issue
Block a user