Skip to content

Commit

Permalink
Add support for PGeo GDAL driver by updating Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
kueda committed Mar 13, 2023
1 parent 95bfa2d commit 7f4a55b
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 91 deletions.
13 changes: 9 additions & 4 deletions .github/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ sudo apt-get update
sudo apt-get install -y \
build-essential \
gdal-bin \
git \
libgdal-dev \
mdbtools-dev \
odbc-mdbtools \
postgis \
python-is-python3 \
python3 \
python3-dev \
python3-gdal \
python3.8 \
python3.8-dev \
python3-pip \
sqlite3 \
unzip \
virtualenv \
zip
pip install -r requirements.txt
python setup.py
2 changes: 1 addition & 1 deletion .github/workflows/build-all-packs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
list-packs:
needs: skip-duplicates
name: List packs
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
Expand Down
35 changes: 25 additions & 10 deletions .github/workflows/build-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
jobs:
rocks:
name: Build rocks
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
services:
postgres:
image: postgis/postgis:12-2.5
Expand All @@ -32,9 +32,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install dependencies
- name: Install Ubuntu dependencies
run: ./.github/dependencies.sh

- name: Install Python dependencies
run: pip install -r requirements.txt && python setup.py

- id: cache-source-work-rocks
name: Cache source work for rocks
uses: actions/cache@v3
Expand All @@ -57,7 +60,7 @@ jobs:

water:
name: Build water
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
services:
postgres:
image: postgis/postgis:12-2.5
Expand All @@ -71,9 +74,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install dependencies
- name: Install Ubuntu dependencies
run: ./.github/dependencies.sh

- name: Install Python dependencies
run: pip install -r requirements.txt && python setup.py

- id: cache-source-work-water
name: Cache source work for water
uses: actions/cache@v3
Expand All @@ -96,7 +102,7 @@ jobs:

contours:
name: Build contours
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
services:
postgres:
image: postgis/postgis:12-2.5
Expand All @@ -110,9 +116,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install dependencies
- name: Install Ubuntu dependencies
run: ./.github/dependencies.sh

- name: Install Python dependencies
run: pip install -r requirements.txt && python setup.py

- name: Cache elevation tiles
id: cache-elevation
uses: actions/cache@v3
Expand All @@ -135,7 +144,7 @@ jobs:

osm:
name: Build ways & context
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
services:
postgres:
image: postgis/postgis:12-2.5
Expand All @@ -149,9 +158,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install dependencies
- name: Install Ubuntu dependencies
run: ./.github/dependencies.sh

- name: Install Python dependencies
run: pip install -r requirements.txt && python setup.py

- name: Get current year week
id: calc-year-week
run: echo "year-week=$(date +'%Y-%U')" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -188,7 +200,7 @@ jobs:

upload-pack:
name: Archive and upload pack
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs:
- rocks
- water
Expand All @@ -197,9 +209,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install dependencies
- name: Install Ubuntu dependencies
run: ./.github/dependencies.sh

- name: Install Python dependencies
run: pip install -r requirements.txt && python setup.py

- name: Download all MBTiles artifacts
uses: actions/download-artifact@v3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
run-pytest:
name: Run pytest
needs: skip-duplicates
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ git clone https://github.com/kueda/underfoot.git
cd underfoot

# Set up a python virtual environment
virtualenv venv -p python3.8
virtualenv venv -p python3
source venv/bin/activate

# Install deps and some stuff for working with ESRI Arc/Info coverages
Expand Down
12 changes: 5 additions & 7 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-20.04"
config.vm.box = "bento/ubuntu-22.04"

config.vm.provider "virtualbox" do |v|
v.memory = 2048
Expand All @@ -15,23 +15,21 @@ Vagrant.configure("2") do |config|
# Modifications to postgres security to allow port forwarding to the host.
# Obviously this is insecure and only meant to be used in a local setting
postgresql_conf_access_for_host = "listen_addresses='*'"
pgsql_mods = "grep -q -F \"#{postgresql_conf_access_for_host}\" /etc/postgresql/12/main/postgresql.conf || echo \"#{postgresql_conf_access_for_host}\" >> /etc/postgresql/12/main/postgresql.conf\n"
pgsql_mods = "grep -q -F \"#{postgresql_conf_access_for_host}\" /etc/postgresql/14/main/postgresql.conf || echo \"#{postgresql_conf_access_for_host}\" >> /etc/postgresql/14/main/postgresql.conf\n"
%w(vagrant ubuntu underfoot).each do |user|
pgsql_mods << "sudo -u postgres psql -c \"DROP ROLE IF EXISTS #{user}; CREATE ROLE #{user} INHERIT LOGIN SUPERUSER PASSWORD '#{user}'\"\n"
pg_hba_access_for_local_ipv4 = "host all #{user} 127.0.0.1/32 trust # Trust all local connections"
pg_hba_access_for_host = "host all #{user} 10.0.2.2/32 trust # Support connections from the vagrant host"
[pg_hba_access_for_local_ipv4, pg_hba_access_for_host].each do |pattern|
pgsql_mods << "grep -q -F '#{pattern}' /etc/postgresql/12/main/pg_hba.conf || echo '#{pattern}' >> /etc/postgresql/12/main/pg_hba.conf\n"
pgsql_mods << "grep -q -F '#{pattern}' /etc/postgresql/14/main/pg_hba.conf || echo '#{pattern}' >> /etc/postgresql/14/main/pg_hba.conf\n"
end
end

# Provision the vm with the relevant dependencies, modify postgres settings
# and create an ubuntu superuser
config.vm.provision "file", source: "./.github/dependencies.sh", destination: "dependencies.sh"
config.vm.provision "shell", inline: <<-SHELL
add-apt-repository ppa:ubuntugis/ppa
add-apt-repository ppa:deadsnakes/ppa
apt-get update
apt-get install -y build-essential git virtualenv python3.8 python3.8-dev python3-gdal gdal-bin libgdal-dev postgis unzip osmosis sqlite3
./dependencies.sh
#{pgsql_mods}
service postgresql restart
SHELL
Expand Down
2 changes: 1 addition & 1 deletion osm.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def load_osm_from_pbf(data_path, pack=None):
"-overwritecache"
]
cmd = [os.path.join("bin", "imposm")] + read_args + write_args
# Load data from PBF into the database with osmosis
# Load data from PBF into the database
util.call_cmd(cmd)


Expand Down
65 changes: 0 additions & 65 deletions osm.sh

This file was deleted.

6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Install some OS-agnostic dependencies"""
from subprocess import run
import os

import shutil

def shell_cmd(cmd, msg=None):
"""Execute a shell command"""
Expand Down Expand Up @@ -37,6 +37,10 @@ def setup_imposm():
work_path = "bin"
if not os.path.isdir("bin"):
os.makedirs(work_path)
if os.path.isdir(os.path.join(work_path, "imposm")):
shutil.rmtree(os.path.join(work_path, "imposm"))
else:
os.remove(os.path.join(work_path, "imposm"))
os.chdir(work_path)
basename = "imposm-0.11.1-linux-x86-64"
run([
Expand Down

0 comments on commit 7f4a55b

Please sign in to comment.