User:ZeLonewolf/Vector Tiles Installation Guide
Jump to navigation
Jump to search
Procedures for creating vector tile server on Ubuntu 20
Packages to Install
- Install postgres during OS Installation (includes postgis)
- osm2pgsql
- golang-go
Other files
- https://learnosm.org/files/default.style
- US Extract: https://download.geofabrik.de/north-america/us-latest.osm.pbf
Set up Postgres
sudo su postgres
createuser gisuser createdb --encoding=UTF8 --owner=gisuser gis psql --username=postgres --dbname=gis -c "CREATE EXTENSION postgis;" psql --username=postgres --dbname=gis -c "CREATE EXTENSION postgis_topology;"
createdb -E utf8 -O postgres natural_earth psql -d natural_earth -c "CREATE EXTENSION postgis;" psql -d natural_earth -c "CREATE EXTENSION hstore;"
psql -c "CREATE USER tegola;" psql -d gis -c "GRANT SELECT ON ALL TABLES IN SCHEMA public TO tegola;"
Trusted Database Login
sudo nano /etc/postgresql/12/main/pg_hba.conf
Near to the bottom of the file you will find these lines:
local all all ident host all all 127.0.0.1/32 md5
On some setups you may see an entry for ipv6:
host all all ::1/128 md5
Change the words ident and md5 each to trust and close the editor. Now reload the database configuration, e.g.
sudo -u postgres /usr/lib/postgresql/12/bin/pg_ctl reload -D /var/lib/postgresql/12/main/
Import map data
sudo -u postgres osm2pgsql --slim --flat-nodes /tmp/osm-cache.bin -C 18000 -c -d gis -U postgres -H localhost -S default.style ../../osm/us-latest.osm.pbf
Compile tegola
git clone https://github.com/go-spatial/tegola.git cd cmd/tegola/ && go build -mod vendor