Skip to content

Instantly share code, notes, and snippets.

Last active February 27, 2022 17:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save msbarry/97776d0ff76cae198e1c0fbd26fed6bd to your computer and use it in GitHub Desktop.
// To run:
// 1) Install java 17 (JDK, not JRE)
// 2) Then get latest planetiler.jar: wget
// 3) Then run this file with: java -cp planetiler.jar --area=monaco --download --force
import com.onthegomap.planetiler.FeatureCollector;
import com.onthegomap.planetiler.FeatureMerge;
import com.onthegomap.planetiler.Planetiler;
import com.onthegomap.planetiler.Profile;
import com.onthegomap.planetiler.VectorTile;
import com.onthegomap.planetiler.config.Arguments;
import com.onthegomap.planetiler.reader.SourceFeature;
import com.onthegomap.planetiler.reader.osm.OsmElement;
import com.onthegomap.planetiler.reader.osm.OsmRelationInfo;
import java.nio.file.Path;
import java.util.List;
public class Powerlines implements Profile {
public void processFeature(SourceFeature sourceFeature, FeatureCollector features) {
if (sourceFeature.canBeLine() && sourceFeature.hasTag("power", "line")) {
.setAttr("class", "line");
public String name() {
return "Powerlines Overlay";
public String description() {
return "An example overlay showing powerlines";
public boolean isOverlay() {
return true;
public String attribution() {
return """
<a href=\"\" target=\"_blank\">&copy; OpenStreetMap contributors</a>
public static void main(String[] args) throws Exception {
static void run(Arguments args) throws Exception {
String area = args.getString("area", "geofabrik area to download", "monaco");
.setProfile(new Powerlines())
.addOsmSource("osm", Path.of("data", "sources", area + ".osm.pbf"), "geofabrik:" + area)
.overwriteOutput("mbtiles", Path.of("data", "powerlines.mbtiles"))
Copy link

wipfli commented Feb 27, 2022

I removed the line starting with java...

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