Skip to content

Commit

Permalink
Misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ofalvai committed Jul 12, 2024
1 parent 760ae91 commit a1c7022
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java 19
java temurin-21.0.1+12.0.LTS
8 changes: 4 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 26 additions & 2 deletions src/main/java/org/openmaptiles/addons/CyclingInfra.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,18 @@ 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") ||
feature.hasTag("cycleway:both", "track");
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
}
Expand All @@ -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;
}
Expand All @@ -87,14 +95,21 @@ 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;
}

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;
}
Expand All @@ -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);
}
}
Expand All @@ -121,4 +140,9 @@ public List<VectorTile.Feature> postProcess(int zoom, List<VectorTile.Feature> i
true
);
}

private Object surfaceOf(SourceFeature feature) {
return feature.getTag("cycleway:surface", feature.getTag("surface"));
}

}
17 changes: 16 additions & 1 deletion src/main/java/org/openmaptiles/addons/CyclingPoi.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}
}

0 comments on commit a1c7022

Please sign in to comment.