Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wipfli/87d9664aba33833a17cb3e18a65f02f5 to your computer and use it in GitHub Desktop.
Save wipfli/87d9664aba33833a17cb3e18a65f02f5 to your computer and use it in GitHub Desktop.

Add buildings to bicycle example in planetiler

git clone https://github.com/onthegomap/planetiler.git
cd planetiler/planetiler-examples

Edit src/main/java/com/onthegomap/planetiler/examples/BikeRouteOverlay.java and add the following lines:

   @Override
   public void processFeature(SourceFeature sourceFeature, FeatureCollector features) {
+    if (sourceFeature.canBePolygon() && sourceFeature.hasTag("building")) {
+      features.polygon("building")
+        .setMinZoom(13);
+    }
     // ignore nodes and ways that should only be treated as polygons
     if (sourceFeature.canBeLine()) {

Compile:

../mvnw clean package --file standalone.pom.xml

Run:

java -cp target/*-with-deps.jar com.onthegomap.planetiler.examples.BikeRouteOverlay --download --area=switzerland

Inspect tiles:

docker run --rm -it -v "$(pwd)/data":/data -p 8080:8080 maptiler/tileserver-gl -p 8080

Screenshot:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment