-
Notifications
You must be signed in to change notification settings - Fork 6
/
OvertureLandcover.java
55 lines (49 loc) · 1.8 KB
/
OvertureLandcover.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import java.nio.file.Path;
import java.util.List;
import com.onthegomap.planetiler.FeatureCollector;
import com.onthegomap.planetiler.Planetiler;
import com.onthegomap.planetiler.Profile;
import com.onthegomap.planetiler.config.Arguments;
import com.onthegomap.planetiler.reader.SourceFeature;
/**
* A single-file profile that generates vector tiles from Overture Maps Land Cover
* data (https://docs.overturemaps.org/schema/reference/base/land_cover/)
*
* To run:
* - download just overture land cover data in a bounding box to
* data/land_cover.parquet (https://docs.overturemaps.org/getting-data/)
* - Run java -cp planetiler.jar OvertureLandcover.java
* - Open data/overture-land_cover.pmtiles in https://pmtiles.io/
*/
public class OvertureLandcover implements Profile {
public static void main(String[] args) {
var arguments = Arguments.fromArgsOrConfigFile(args);
Planetiler.create(arguments)
.setProfile(new OvertureLandcover())
.addParquetSource("overture", List.of(Path.of("data", "land_cover.parquet")))
.overwriteOutput(Path.of("data", "overture-land_cover.pmtiles"))
.run();
}
@Override
public void processFeature(SourceFeature source, FeatureCollector features) {
var cartography = source.getStruct("cartography");
var minZoom = cartography.get("min_zoom").asInt();
var maxZoom = cartography.get("max_zoom").asInt();
features.polygon("land_cover")
.setMinZoom(minZoom)
.setMaxZoom(maxZoom)
.inheritAttrsFromSource("subtype");
}
@Override
public boolean isOverlay() {
return true;
}
@Override
public String attribution() {
return """
<a href="https://docs.overturemaps.org/attribution" target="_blank">© Overture Maps Foundation</a>
"""
.replace("\n", " ")
.trim();
}
}