Added Dockerfile for VPB terrain generator
Added a Dockerfile that can be used to build a docker/podman image with the required environment for VPB terrain generator. A sample generation script is also included.
This commit is contained in:
parent
1be19e5f12
commit
54e68e949f
6 changed files with 137 additions and 0 deletions
16
ws30/ws30-vbp-generator-docker/.gitignore
vendored
Normal file
16
ws30/ws30-vbp-generator-docker/.gitignore
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Data files
|
||||
*.zip
|
||||
*.hdr
|
||||
*.tfw
|
||||
*.tif
|
||||
|
||||
## Corine
|
||||
data/u2018_clc2018_v2020_20u1_raster100m/
|
||||
## SRTM
|
||||
data/readme.txt
|
||||
|
||||
# macOS
|
||||
*.DS_Store
|
||||
|
||||
# Output folder
|
||||
output
|
44
ws30/ws30-vbp-generator-docker/Dockerfile
Normal file
44
ws30/ws30-vbp-generator-docker/Dockerfile
Normal file
|
@ -0,0 +1,44 @@
|
|||
FROM ubuntu:focal
|
||||
|
||||
WORKDIR /home/flightgear/build/
|
||||
|
||||
# Set timezone:
|
||||
RUN ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
git \
|
||||
libnvtt-dev
|
||||
|
||||
RUN git clone --branch release/2.4 https://github.com/OSGeo/gdal.git
|
||||
WORKDIR /home/flightgear/build/gdal/gdal
|
||||
RUN ./configure
|
||||
RUN make -j $(nproc)
|
||||
RUN make install
|
||||
|
||||
WORKDIR /home/flightgear/build/
|
||||
RUN git clone --branch OpenSceneGraph-3.6.5 https://github.com/openscenegraph/OpenSceneGraph.git
|
||||
RUN mkdir OpenSceneGraph/build/
|
||||
RUN cat /etc/apt/sources.list
|
||||
RUN sed -i 's/# deb-src/deb-src/' /etc/apt/sources.list
|
||||
RUN cat /etc/apt/sources.list
|
||||
RUN apt-get update && apt-get build-dep -y openscenegraph
|
||||
WORKDIR OpenSceneGraph/build
|
||||
RUN cmake -D CMAKE_BUILD_TYPE="Release" -D CMAKE_CXX_FLAGS_RELEASE="-O3 -pipe" -D CMAKE_C_FLAGS_RELEASE="-O3 -pipe" -D CMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOLEAN="true" -G "Unix Makefiles" ..
|
||||
RUN make -j $(nproc)
|
||||
RUN make install
|
||||
|
||||
WORKDIR /home/flightgear/build/
|
||||
RUN git clone https://github.com/openscenegraph/VirtualPlanetBuilder.git && cd VirtualPlanetBuilder && git checkout VirtualPlanetBuilder-1.0
|
||||
RUN mkdir VirtualPlanetBuilder/build/
|
||||
WORKDIR /home/flightgear/build/VirtualPlanetBuilder/build/
|
||||
RUN cmake ..
|
||||
RUN make -j $(nproc)
|
||||
RUN make install
|
||||
|
||||
WORKDIR /home/flightgear/
|
||||
ENV LD_LIBRARY_PATH /usr/local/lib64:/usr/local/lib
|
||||
|
||||
CMD ["/bin/bash"]
|
29
ws30/ws30-vbp-generator-docker/README.md
Normal file
29
ws30/ws30-vbp-generator-docker/README.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
# VirtualPlanetBuilder Terrain Generation for FlightGear
|
||||
|
||||
This repository provides a DockerFile that can generate an image to build VPB terrain. It is currently based on the following versions:
|
||||
|
||||
* Ubuntu 20.04 (LTS)
|
||||
* GDAL 2.4
|
||||
* OpenSceneGraph 3.6.5
|
||||
* VirtualPlanetBuilder 1.0
|
||||
|
||||
To build the image, run `build_image.sh`. This will build and tag the image with the name `flightgear/ws30-vbp-generator:v1`.
|
||||
|
||||
## Building terrain
|
||||
The provided `run_image.sh` will launch a container and present a `bash` prompt with the environment for building all set up:
|
||||
|
||||
* GDAL and VPB executables will be available to run
|
||||
* The `data` directory will be mounted at `/home/flightgear/data/` inside the container (readonly)
|
||||
* The `output` directory will be mounted at `/home/flightgear/output` inside the container with write access
|
||||
|
||||
A sample script in `data/run.sh` is provided to automatically build a small area around Edinburgh. To build the terrain:
|
||||
1. First download SRTM heightmap and CORINE landclass data (see the wiki for details: [https://wiki.flightgear.org/Virtual_Planet_Builder](https://wiki.flightgear.org/Virtual_Planet_Builder) and `data/run.sh` for links)
|
||||
2. Extract the files to `./data`
|
||||
3. Launch the container with `./run_image.sh`
|
||||
4. Run `./data/run.sh` at the prompt. The script will saves all output to the mounted `./output` folder, so its accessible outside the container.
|
||||
|
||||
A shorthand for steps 3-4 is also available:
|
||||
|
||||
```bash
|
||||
./run_image.sh ./data/run.sh
|
||||
```
|
3
ws30/ws30-vbp-generator-docker/build_image.sh
Executable file
3
ws30/ws30-vbp-generator-docker/build_image.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
docker build . -t flightgear/ws30-vbp-generator:v1
|
34
ws30/ws30-vbp-generator-docker/data/run.sh
Executable file
34
ws30/ws30-vbp-generator-docker/data/run.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Sample script to build a small ws30 tile
|
||||
|
||||
# This script assumes the data is already present (in the same directory as this script).
|
||||
# SRTM data from:
|
||||
# https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/srtm_34_02.zip
|
||||
# https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/srtm_35_01.zip
|
||||
# https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/srtm_35_02.zip
|
||||
# https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/srtm_36_01.zip
|
||||
# https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/srtm_36_02.zip
|
||||
#
|
||||
# CORINE landcover from:
|
||||
# https://land.copernicus.eu/pan-european/corine-land-cover/clc2018?tab=download
|
||||
# (behind registration wall - Corine Land Cover - 100 meter Raster)
|
||||
|
||||
osgdem \
|
||||
--TERRAIN \
|
||||
--compressor-nvtt \
|
||||
--compression-quality-highest \
|
||||
--no-interpolate-imagery \
|
||||
--disable-error-diffusion \
|
||||
--geocentric \
|
||||
-t /home/flightgear/data/u2018_clc2018_v2020_20u1_raster100m/DATA/U2018_CLC2018_V2020_20u1.tif \
|
||||
-d /home/flightgear/data/srtm_34_02.tif \
|
||||
-d /home/flightgear/data/srtm_35_01.tif \
|
||||
-d /home/flightgear/data/srtm_35_02.tif \
|
||||
-d /home/flightgear/data/srtm_36_01.tif \
|
||||
-d /home/flightgear/data/srtm_36_02.tif \
|
||||
-b -4 50 -3 51 \
|
||||
--PagedLOD \
|
||||
-l 7 \
|
||||
--radius-to-max-visible-distance-ratio 3 \
|
||||
-o /home/flightgear/output/vpb/w010n50/w004n50/ws_w004n50.osgb
|
11
ws30/ws30-vbp-generator-docker/run_image.sh
Executable file
11
ws30/ws30-vbp-generator-docker/run_image.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
BASE_DIR="/home/flightgear"
|
||||
|
||||
mkdir -p output
|
||||
docker run \
|
||||
--rm \
|
||||
--mount "type=bind,source=`pwd`/data,target=${BASE_DIR}/data,readonly" \
|
||||
--mount "type=bind,source=`pwd`/output,target=${BASE_DIR}/output" \
|
||||
-it \
|
||||
flightgear/ws30-vbp-generator:v1 /bin/bash $1
|
Loading…
Add table
Reference in a new issue