...
 
Commits (8)
data
.idea
\ No newline at end of file
[submodule "tileserver-gl"]
path = tileserver-gl
url = https://github.com/klokantech/tileserver-gl.git
# Use the Makefile to make sure the base image is available
FROM floawfloaw/light-world-tileserver:latest
ARG ZOOM
COPY ./data/${ZOOM}.mbtiles /data/${ZOOM}.mbtiles
BSD 2-Clause License
Copyright (c) 2019, Rex Dri
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
init_light_folder:
cd tileserver-gl && node publish.js || echo "osef si ça foire"
sed -i "1s/.*/FROM node:10.15.1-alpine/" tileserver-gl/light/Dockerfile
build_base_image: init_light_folder
cd tileserver-gl/light && docker build --tag floawfloaw/light-world-tileserver:latest .
build_image_8: build_base_image
docker build --build-arg ZOOM=8 --tag floawfloaw/light-world-tileserver:latest--zoom-8 .
build_image_11: build_base_image
docker build --build-arg ZOOM=11 --tag floawfloaw/light-world-tileserver:latest--zoom-11 .
run:
docker run --rm -it -p 8080:80 floawfloaw/light-world-tileserver:latest--zoom-8
\ No newline at end of file
# open-tiler
Open-tiler
==========
A simple way to generate vector map tiles of the entire world.
## Setup
In the `ansible` directory you will find the *ansible* scripts to setup a remote server with all the dependencies needed to compute the tiles.
## To compute the tiles
(after you have run the ansible script)
```bash
cd /usr/src/openmaptiles
mkdir data
cd data
# Download the OSM data for the whole world (~50GB as of 2019-12-05)
wget -O planet.osm.pbf https://planet.osm.org/pbf/planet-latest.osm.pbf
```
Then edit the `.env` file:
```bash
cd /usr/src/openmaptiles
nano .env
```
And set:
- `QUICKSTART_MAX_ZOOM=11`
- `MAX_ZOOM=11` (not sure if this one is 100% useful)
Then, run `tmux` and:
```bash
cd /usr/src/openmaptiles
./quickstart.sh planet
```
The process should take a bit more than 24 hours on reasonably sized server (you need at least 600-700GB of disk space).
## Generating lower zoom mbtiles
To reduce the zoom level of the mbtiles (and reduce therefore the size), you need to use:
```bash
sqlite3 8.mbtiles
```
Then use the following SQL commands (taken from [here](https://gist.github.com/zhm/3830471)):
```SQL
DELETE FROM images WHERE
tile_id IN (SELECT tile_id FROM map WHERE zoom_level > 8) AND
tile_id NOT IN (SELECT tile_id FROM map WHERE zoom_level <= 8);
DELETE FROM map WHERE zoom_level > 8;
UPDATE metadata SET value = '8' WHERE name = 'maxzoom';
```
Make sure to finish by the following command to rebuild the `mbtiles` file:
```SQL
VACUUM;
```
## Building the images
The image provided by https://github.com/klokantech/tileserver-gl was not up-to-date and not small enough (and I am lazy to do a PR for now). So this repo contains a submodule pointing a specific commit of this repo.
There is a Makefile to automate the creation process of the images.
docker run --rm -it -p 8080:80 floawfloaw/light-world-tileserver:8-latest
Ansible -- setup server for computing tiles
======================
Make sure you can connect to the remote server of your choice :smile:
* Install `ansible`
* Install `ansible-galaxy` dependencies:
- `ansible-galaxy install -r requirements.yml`
* Setup env variables:
- Change the `IP` of the remote host server in `inventory.yml`
* Run:
```bash
ansible-playbook -i inventory.yml playbook.yml
```
:confetti_ball:
\ No newline at end of file
all:
hosts: 163.172.156.3
---
- hosts: all
become: yes
gather_facts: yes
vars:
ansible_user: root
commit: dev
pip_install_packages:
- name: docker
pre_tasks:
- name: "Install required ansible dependencies"
become: yes
package:
name: libselinux-python
state: present
- name: "Install git"
become: yes
package:
name: git
state: present
- name: "Install wget"
become: yes
package:
name: wget
state: present
- name: "Install tmux"
become: yes
package:
name: tmux
state: present
- name: "Install nano"
become: yes
package:
name: nano
state: present
- name: "Install htop"
become: yes
package:
name: htop
state: present
- name: "Install nodejs"
become: yes
package:
name: nodejs
state: present
roles:
- geerlingguy.pip
- geerlingguy.docker
tasks:
- name: "copy this repo"
git:
repo: "https://gitlab.utc.fr/rex-dri/open-tiler.git"
dest: /usr/src/open-tiler
force: yes
version: "{{ commit }}"
- name: "copy openmaptiles repo"
git:
repo: "https://github.com/openmaptiles/openmaptiles.git"
dest: /usr/src/openmaptiles
force: yes
\ No newline at end of file
- src: geerlingguy.pip # To later manage docker
- src: geerlingguy.docker
\ No newline at end of file
Subproject commit e5060147633a654ee3ec12b19804d1e0a1b85570