From a1c70229f04a93ef78d0a3b817fbe43e7bfba0e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliv=C3=A9r=20Falvai?= Date: Fri, 12 Jul 2024 15:32:15 +0200 Subject: [PATCH] Misc changes --- .tool-versions | 2 +- justfile | 8 +++--- .../org/openmaptiles/addons/CyclingInfra.java | 28 +++++++++++++++++-- .../org/openmaptiles/addons/CyclingPoi.java | 17 ++++++++++- 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/.tool-versions b/.tool-versions index f760da29..51695cfb 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -java 19 +java temurin-21.0.1+12.0.LTS diff --git a/justfile b/justfile index dcbb1c52..848928ae 100644 --- a/justfile +++ b/justfile @@ -3,13 +3,13 @@ default: jar_path := "target/*with-deps.jar" -clean-build-europe: build-planetiler +clean-build AREA: build-planetiler java -Xmx20g \ `# return unused heap memory to the OS` \ -XX:MaxHeapFreeRatio=40 \ - -jar {{jar_path}} --force --download \ - --area=europe \ - --output=data/planetiler-europe-cycling.mbtiles \ + -jar {{jar_path}} --force \ + --area={{AREA}} \ + --output=data/planetiler-{{AREA}}-cycling.mbtiles \ `# Store temporary node locations at fixed positions in a memory-mapped file` \ --nodemap-type=array --storage=mmap \ --config=config-cycling.properties diff --git a/src/main/java/org/openmaptiles/addons/CyclingInfra.java b/src/main/java/org/openmaptiles/addons/CyclingInfra.java index d75e5350..2efbc145 100644 --- a/src/main/java/org/openmaptiles/addons/CyclingInfra.java +++ b/src/main/java/org/openmaptiles/addons/CyclingInfra.java @@ -57,7 +57,7 @@ public void processAllOsm(SourceFeature feature, FeatureCollector features) { } boolean isCycleway = feature.hasTag("highway", "cycleway"); - boolean isDesignated = feature.hasTag("bicycle", "designated"); + boolean isDesignated = feature.hasTag("bicycle", "designated") && !feature.hasTag("highway", "rest_area"); boolean isTrack = feature.hasTag("cycleway", "track") || feature.hasTag("cycleway:left", "track") || feature.hasTag("cycleway:right", "track") || @@ -65,6 +65,10 @@ public void processAllOsm(SourceFeature feature, FeatureCollector features) { if (isCycleway || isDesignated || isTrack) { features.line(LAYER_NAME) .setAttr("class", "cycleway") + .setAttr("lit", feature.getTag("lit")) + .setAttr("surface", surfaceOf(feature)) + .setAttr("smoothness", feature.getTag("smoothness")) + // TODO: set attr for foot access/segregation .setMinPixelSize(0); // merge short lines in postProcess() return; // highest priority feature, we don't care if tags satisfy other criteria } @@ -76,6 +80,10 @@ public void processAllOsm(SourceFeature feature, FeatureCollector features) { if (isLane) { features.line(LAYER_NAME) .setAttr("class", "cycle_lane") + .setAttr("lit", feature.getTag("lit")) + .setAttr("surface", surfaceOf(feature)) + .setAttr("smoothness", feature.getTag("smoothness")) + .setAttr("highway", feature.getTag("highway")) .setMinPixelSize(0); // merge short lines in postProcess() return; } @@ -87,6 +95,10 @@ public void processAllOsm(SourceFeature feature, FeatureCollector features) { ) { features.line(LAYER_NAME) .setAttr("class", "cycle_shared") + .setAttr("lit", feature.getTag("lit")) + .setAttr("surface", surfaceOf(feature)) + .setAttr("smoothness", feature.getTag("smoothness")) + .setAttr("highway", feature.getTag("highway")) .setMinPixelSize(0); return; } @@ -94,7 +106,10 @@ public void processAllOsm(SourceFeature feature, FeatureCollector features) { if (feature.hasTag("cycleway", "opposite") || feature.hasTag("oneway:bicycle", "no")) { features.line(LAYER_NAME) .setAttr("class", "cycle_no_infra") - .setAttr("subclass", "two_way") + .setAttr("subclass", "two_way_for_bicycle") + .setAttr("lit", feature.getTag("lit")) + .setAttr("surface", surfaceOf(feature)) + .setAttr("smoothness", feature.getTag("smoothness")) .setMinPixelSize(0); // merge short lines in postProcess() return; } @@ -108,6 +123,10 @@ public void processAllOsm(SourceFeature feature, FeatureCollector features) { features.line(LAYER_NAME) .setAttr("class", "cycle_no_infra") .setAttr("subclass", "cycle_route") + .setAttr("lit", feature.getTag("lit")) + .setAttr("surface", surfaceOf(feature)) + .setAttr("smoothness", feature.getTag("smoothness")) + .setAttr("highway", feature.getTag("highway")) .setMinPixelSize(0); } } @@ -121,4 +140,9 @@ public List postProcess(int zoom, List i true ); } + + private Object surfaceOf(SourceFeature feature) { + return feature.getTag("cycleway:surface", feature.getTag("surface")); + } + } diff --git a/src/main/java/org/openmaptiles/addons/CyclingPoi.java b/src/main/java/org/openmaptiles/addons/CyclingPoi.java index c677b8b5..04a505f2 100644 --- a/src/main/java/org/openmaptiles/addons/CyclingPoi.java +++ b/src/main/java/org/openmaptiles/addons/CyclingPoi.java @@ -25,7 +25,22 @@ public void processAllOsm(SourceFeature feature, FeatureCollector features) { if (feature.hasTag("amenity", "bicycle_repair_station")) { features.centroidIfConvex(LAYER_NAME) .setMinZoom(13) - .setAttr("class", "bicycle_repair_station"); + .setAttr("class", "bicycle_repair_station") + .setAttr("pump", feature.getTag("service:bicycle:pump")) + .setAttr("chain_tool", feature.getTag("service:bicycle:chain_tool")) + .setAttr("tools", feature.getTag("service:bicycle:tools")) + .setAttr("stand", feature.getTag("service:bicycle:stand")) + .setAttr("operator", feature.getTag("operator")) + .setAttr("brand", feature.getTag("brand")) + .setAttr("opening_hours", feature.getTag("opening_hours")); + } + + if (feature.hasTag("amenity", "bicycle_rental") && feature.hasTag("network", "bubi", "BuBi")) { + features.centroidIfConvex(LAYER_NAME) + .setMinZoom(13) + .setAttr("class", "bicycle_rental") + .setAttr("network", "bubi") + .setAttr("capacity", feature.getTag("capacity")); } } }