Skip to content

Commit

Permalink
Move basemap profile into OpenMapTiles submodule (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
lazaa32 authored Jul 29, 2022
1 parent 232834e commit 88c7f56
Show file tree
Hide file tree
Showing 75 changed files with 352 additions and 14,329 deletions.
2 changes: 1 addition & 1 deletion .github/cache-sources-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ runs:
- name: Get Date
id: get-data
run: |
echo "::set-output name=hash::${{ hashFiles('**/Planetiler.java', '**/Downloader.java', '**/Geofabrik.java', '**/BasemapMain.java') }}"
echo "::set-output name=hash::${{ hashFiles('**/Planetiler.java', '**/Downloader.java', '**/Geofabrik.java', '**/OpenMapTilesMain.java') }}"
echo "::set-output name=date::$(date -u "+%Y-%m-%d")"
shell: bash
working-directory: ${{ inputs.basedir }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Run link check
uses: gaurav-nelson/[email protected]
with:
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -45,6 +47,8 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v3
with:
Expand All @@ -66,6 +70,8 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand All @@ -74,8 +80,8 @@ jobs:
cache: 'maven'
- run: ./scripts/regenerate-openmaptiles.sh
# Skip spotless since that gets checked in a separate task
- run: ./mvnw -Dspotless.check.skip -DskipTests --batch-mode -no-transfer-progress clean install -pl planetiler-basemap -am
- run: ./mvnw -Dspotless.check.skip --batch-mode -no-transfer-progress verify -pl planetiler-basemap
- run: ./mvnw -Dspotless.check.skip -DskipTests --batch-mode -no-transfer-progress clean install -pl planetiler-openmaptiles -am
- run: ./mvnw -Dspotless.check.skip --batch-mode -no-transfer-progress verify -pl planetiler-openmaptiles

examples:
name: Example project
Expand All @@ -84,6 +90,8 @@ jobs:
continue-on-error: true
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand All @@ -108,6 +116,8 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache data/sources
uses: ./.github/cache-sources-action
- name: Set up JDK
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ jobs:
uses: actions/checkout@v3
with:
path: branch
submodules: true
- name: 'Checkout base'
uses: actions/checkout@v3
with:
path: base
ref: ${{ github.event.pull_request.base.sha }}
submodules: true
- name: Cache data/sources
uses: ./branch/.github/cache-sources-action
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
version = context.payload.inputs.version;
if (/^v/.test(version)) throw new Error("Bad version number: " + version)
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache data/sources
uses: ./.github/cache-sources-action
- uses: actions/setup-java@v3
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache data/sources
uses: ./.github/cache-sources-action
- name: Set up JDK
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/update-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
# report status back to pull request
- uses: haya14busa/action-workflow_run-status@v1
- uses: actions/checkout@v3
with:
submodules: true
- name: 'Download branch build info'
uses: dawidd6/action-download-artifact@v2
with:
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "planetiler-openmaptiles"]
path = planetiler-openmaptiles
url = https://github.com/openmaptiles/planetiler-openmaptiles.git
branch = main
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pull requests are welcome! Any pull request should:

To set up your local development environment:

- Fork the repo
- Fork the repo [setup submodules](README.md#git-submodules)
- Install Java 16 or later. You can download Java manually from [Adoptium](https://adoptium.net/installation.html) or
use:
- [Windows installer](https://adoptium.net/installation.html#windows-msi)
Expand Down
3 changes: 0 additions & 3 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ The `planetiler-core` module includes the following software:
from [github.com/rawrunprotected/hilbert_curves](https://github.com/rawrunprotected/hilbert_curves) (Public Domain)
- `osmformat.proto` and `fileformat.proto` (generates `Osmformat.java` and `Fileformat.java`)
from [openstreetmap/OSM-binary](https://github.com/openstreetmap/OSM-binary/tree/master/osmpbf) (MIT License)

Additionally, the `planetiler-basemap` module is based on [OpenMapTiles](https://github.com/openmaptiles/openmaptiles):

- Maven Dependencies:
- org.yaml:snakeyaml (Apache license)
- org.commonmark:commonmark (BSD 2-clause license)
Expand Down
5 changes: 3 additions & 2 deletions PLANET.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generating a Map of the World

To generate a map of the world using the built-in [basemap profile](planetiler-basemap), you will need a machine with
To generate a map of the world using the built-in [OpenMapTiles profile](https://github.com/openmaptiles/planetiler-openmaptiles), you will need a
machine with
Java 16 or later installed and at least 10x as much disk space and at least 0.5x as much RAM as the `planet.osm.pbf`
file you start from. All testing has been done using Digital Ocean droplets with dedicated
vCPUs ([referral link](https://m.do.co/c/a947e99aab25)) and OpenJDK 17 installed through `apt`. Planetiler splits work
Expand Down Expand Up @@ -66,7 +67,7 @@ java -Xmx20g \

Run with `--help` to see all available arguments.

NOTE: The default basemap profile merges nearby buildings at zoom-level 13 (for example,
NOTE: The default OpenMapTiles profile merges nearby buildings at zoom-level 13 (for example,
see [Boston](https://onthegomap.github.io/planetiler-demo/#13.08/42.35474/-71.06597)). This adds about 14 CPU hours (~50
minutes with 16 CPUs) to planet generation time and can be disabled using `--building-merge-z13=false`.

Expand Down
47 changes: 38 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ See the [live demo](https://onthegomap.github.io/planetiler-demo/) of vector til
the [OpenStreetMap Americana Project](https://github.com/ZeLonewolf/openstreetmap-americana/).

[![Planetiler Demo Screenshot](./diagrams/demo.png)](https://onthegomap.github.io/planetiler-demo/)
Style [© OpenMapTiles](https://www.openmaptiles.org/)
· Data [© OpenStreetMap contributors](https://www.openstreetmap.org/copyright)
[© OpenMapTiles](https://www.openmaptiles.org/) [© OpenStreetMap contributors](https://www.openstreetmap.org/copyright)

## Usage

To generate a map of an area using the [basemap profile](planetiler-basemap), you will need:
To generate a map of an area using the [OpenMapTiles profile](https://github.com/openmaptiles/planetiler-openmaptiles),
you will need:

- Java 16+ (see [CONTRIBUTING.md](CONTRIBUTING.md)) or [Docker](https://docs.docker.com/get-docker/)
- at least 1GB of free disk space plus 5-10x the size of the `.osm.pbf` file
Expand All @@ -53,7 +53,8 @@ Or using Docker:
docker run -e JAVA_TOOL_OPTIONS="-Xmx1g" -v "$(pwd)/data":/data ghcr.io/onthegomap/planetiler:latest --download --area=monaco
```

:warning: This starts off by downloading about 1GB of [data sources](NOTICE.md#data) required by the basemap profile
:warning: This starts off by downloading about 1GB of [data sources](NOTICE.md#data) required by the OpenMapTiles
profile
including ~750MB for [ocean polygons](https://osmdata.openstreetmap.de/data/water-polygons.html) and ~240MB
for [Natural Earth Data](https://www.naturalearthdata.com/).

Expand Down Expand Up @@ -107,6 +108,32 @@ Some common arguments:
- `--force` overwrites the output file
- `--help` shows all of the options and exits

### Git submodules

Planetiler has a submodule dependency
on [planetiler-openmaptiles](https://github.com/openmaptiles/planetiler-openmaptiles). Add `--recurse-submodules`
to `git clone`, `git pull`, or `git checkout` commands to also update submodule dependencies.

To clone the repo with submodules:

```bash
git clone --recurse-submodules https://github.com/onthegomap/planetiler.git
```

If you already pulled the repo, you can initialize submodules with:

```bash
git submodule update --init
```

To force git to always update submodules (recommended), run this command in your local repo:

```bash
git config --local submodule.recurse true
```

Learn more about working with submodules [here](https://git-scm.com/book/en/v2/Git-Tools-Submodules).

## Generating a Map of the World

See [PLANET.md](PLANET.md).
Expand All @@ -117,7 +144,7 @@ See the [planetiler-examples](planetiler-examples) project.

## Benchmarks

Some example runtimes for the Basemap OpenMapTiles-compatible profile (excluding downloading resources):
Some example runtimes for the OpenMapTiles profile (excluding downloading resources):

| Input | Version | Machine | Time | mbtiles size | Logs |
|-------------------------------------------------------------------------------------------------------------------------------------------|---------|---------------------------------|---------------------------------|--------------|------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -142,8 +169,9 @@ Merging nearby buildings at z13 is very expensive, when run with `--building-mer
Some other tools that generate vector tiles from OpenStreetMap data:

- [OpenMapTiles](https://github.com/openmaptiles/openmaptiles) is the reference implementation of
the [OpenMapTiles schema](https://openmaptiles.org/schema/) that the [basemap profile](planetiler-basemap) is based
on. It uses an intermediate postgres database and operates in two modes:
the [OpenMapTiles schema](https://openmaptiles.org/schema/) that
the [OpenMapTiles profile](https://github.com/openmaptiles/planetiler-openmaptiles)
is based on. It uses an intermediate postgres database and operates in two modes:
1. Import data into database (~1 day) then serve vector tiles directly from the database. Tile serving is slower and
requires bigger machines, but lets you easily incorporate realtime updates
2. Import data into database (~1 day) then pregenerate every tile for the planet into an mbtiles file which
Expand Down Expand Up @@ -172,7 +200,7 @@ download regularly-updated tilesets.
using [JTS geometry utilities](https://github.com/locationtech/jts)
- Merge nearby lines or polygons with the same tags before emitting vector tiles
- Automatically fixes self-intersecting polygons
- Built-in basemap profile based on [OpenMapTiles](https://openmaptiles.org/) v3.13.1
- Built-in OpenMapTiles profile based on [OpenMapTiles](https://openmaptiles.org/) v3.13.1
- Optionally download additional name translations for elements from Wikidata
- Export real-time stats to a [prometheus push gateway](https://github.com/prometheus/pushgateway) using
`--pushgateway=http://user:password@ip` argument (and a [grafana dashboard](grafana.json) for viewing)
Expand Down Expand Up @@ -244,7 +272,8 @@ Planetiler is made possible by these awesome open source projects:

- [OpenMapTiles](https://openmaptiles.org/) for the [schema](https://openmaptiles.org/schema/)
and [reference implementation](https://github.com/openmaptiles/openmaptiles)
that the [basemap profile](planetiler-basemap/src/main/java/com/onthegomap/planetiler/basemap/layers)
that
the [openmaptiles profile](https://github.com/openmaptiles/planetiler-openmaptiles/tree/main/src/main/java/com/onthegomap/planetiler/openmaptiles/layers)
is based on
- [Graphhopper](https://www.graphhopper.com/) for basis of utilities to process OpenStreetMap data in Java
- [JTS Topology Suite](https://github.com/locationtech/jts) for working with vector geometries
Expand Down
2 changes: 1 addition & 1 deletion config-example.properties
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
# mbtiles_version=0.1
# mbtiles_type=baselayer OR overlay

################# Basemap profile config #################
################# OpenMapTiles profile config #################

# Set the input file name and automatically determine the https://download.geofabrik.de/ download URL for a region by name:
# area=monaco
Expand Down
67 changes: 0 additions & 67 deletions planetiler-basemap/README.md

This file was deleted.

56 changes: 0 additions & 56 deletions planetiler-basemap/pom.xml
Original file line number Diff line number Diff line change
@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>planetiler-basemap</artifactId>

<parent>
<groupId>com.onthegomap.planetiler</groupId>
<artifactId>planetiler-parent</artifactId>
<version>0.5-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>com.onthegomap.planetiler</groupId>
<artifactId>planetiler-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
<dependency>
<groupId>org.commonmark</groupId>
<artifactId>commonmark</artifactId>
<version>0.19.0</version>
</dependency>

<dependency>
<groupId>com.onthegomap.planetiler</groupId>
<artifactId>planetiler-core</artifactId>
<version>${project.parent.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.github.zlika</groupId>
<artifactId>reproducible-build-maven-plugin</artifactId>
</plugin>

<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<!-- we don't want to deploy this module -->
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit 88c7f56

Please sign in to comment.