Merge branch 'develop' of github.com:kartoza/docker-osm into develop

pull/87/head
admire 2019-09-26 10:00:11 +02:00
commit 0bd503acea
5 zmienionych plików z 625 dodań i 650 usunięć

Wyświetl plik

@ -16,7 +16,6 @@ status:
@echo "------------------------------------------------------------------" @echo "------------------------------------------------------------------"
@docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) ps @docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) ps
build: build:
@echo @echo
@echo "------------------------------------------------------------------" @echo "------------------------------------------------------------------"
@ -129,15 +128,14 @@ validate_geom: validate_geom
@echo "------------------------------------------------------------------" @echo "------------------------------------------------------------------"
@echo "Validating geom for all tables" @echo "Validating geom for all tables"
@echo "------------------------------------------------------------------" @echo "------------------------------------------------------------------"
@docker exec -t -i $(PROJECT_ID)_db /bin/su - postgres -c "psql gis -c 'Select validate_geom();'" @docker exec -t -i $(PROJECT_ID)_db /bin/su - postgres -c "psql gis -c 'SELECT validate_geom();'"
clip_tables: clip_tables clip_tables: clip_tables
@echo @echo
@echo "------------------------------------------------------------------" @echo "------------------------------------------------------------------"
@echo "Clip tables using the clip layer" @echo "Clip tables using the clip layer"
@echo "------------------------------------------------------------------" @echo "------------------------------------------------------------------"
@docker exec -t -i $(PROJECT_ID)_db /bin/su - postgres -c "psql gis -c 'Select clean_tables();'" @docker exec -t -i $(PROJECT_ID)_db /bin/su - postgres -c "psql gis -c 'SELECT clean_tables();'"

Wyświetl plik

@ -5,6 +5,9 @@ volumes:
import_done: import_done:
import_queue: import_queue:
cache: cache:
pg:
grafana:
pw2:
services: services:
db: db:
@ -70,7 +73,7 @@ services:
# Install some styles if you are using the default mapping. It can be 'yes' or 'no' # Install some styles if you are using the default mapping. It can be 'yes' or 'no'
- QGIS_STYLE=yes - QGIS_STYLE=yes
# Use clip in the database - To use this you should have run make import_clip to add your clip to the DB # Use clip in the database - To use this you should have run make import_clip to add your clip to the DB
- CLIP=yes - CLIP=no
osmupdate: osmupdate:
build: docker-osmupdate build: docker-osmupdate
@ -105,3 +108,30 @@ services:
# seconds between 2 executions of the script # seconds between 2 executions of the script
# if 0, then no update will be done, only the first initial import from the PBF # if 0, then no update will be done, only the first initial import from the PBF
- TIME=120 - TIME=120
pgwatch2:
image: cybertec/pgwatch2-postgres
hostname: pgwatch2
volumes:
- pg:/var/lib/postgresql
- grafana:/var/lib/grafana
- pw2:/pgwatch2/persistent-config
environment:
- PW2_TESTDB=false
- PW2_PG_SCHEMA_TYPE=metric-dbname-time
- PW2_WEBNOANONYMOUS=true
- PW2_WEBUSER=admin
- PW2_WEBPASSWORD=pgwatch2
- PW2_WEBNOCOMPONENTLOGS=false
- PW2_WEBHOST=0.0.0.0
- PW2_WEBPORT=8080
- PW2_GRAFANANOANONYMOUS=true
- PW2_GRAFANAUSER=admin
- PW2_GRAFANAPASSWORD=pgwatch2
- PW2_GRAFANA_BASEURL=http://0.0.0.0:3000
restart: on-failure
ports:
- 3000:3000
- 8080:8080
depends_on:
db:
condition: service_healthy

Wyświetl plik

@ -101,7 +101,7 @@ class Importer(object):
msg = 'QGIS_STYLE not supported : %s' % self.default['QGIS_STYLE'] msg = 'QGIS_STYLE not supported : %s' % self.default['QGIS_STYLE']
self.error(msg) self.error(msg)
else: else:
self.info('Qgis style: ' + self.default['QGIS_STYLE']) self.info('QGIS style: ' + self.default['QGIS_STYLE'])
# Check folders. # Check folders.
folders = ['IMPORT_QUEUE', 'IMPORT_DONE', 'SETTINGS', 'CACHE'] folders = ['IMPORT_QUEUE', 'IMPORT_DONE', 'SETTINGS', 'CACHE']
@ -204,9 +204,7 @@ class Importer(object):
self.default['POSTGRES_PASS'])) self.default['POSTGRES_PASS']))
self.cursor = connection.cursor() self.cursor = connection.cursor()
except OperationalError as e: except OperationalError as e:
print(stderr.write(e)) self.error(e)
exit()
self.postgis_uri = 'postgis://%s:%s@%s/%s' % ( self.postgis_uri = 'postgis://%s:%s@%s/%s' % (
self.default['POSTGRES_USER'], self.default['POSTGRES_USER'],
@ -246,7 +244,7 @@ class Importer(object):
command += ['-d', self.default['POSTGRES_DBNAME']] command += ['-d', self.default['POSTGRES_DBNAME']]
command += ['-f', self.clip_sql_file] command += ['-f', self.clip_sql_file]
call(command) call(command)
self.info('!! Be sure to run \'make import_clip\' to import the shapefile into the DB !!') self.info('!! Be sure to run \'make import_clip\' to import the Shapefile into the DB !!')
def perform_clip_in_db(self): def perform_clip_in_db(self):
"""Perform clipping if the clip table is here.""" """Perform clipping if the clip table is here."""

Wyświetl plik

@ -18,11 +18,8 @@ END;
$BODY$ $BODY$
LANGUAGE plpgsql; LANGUAGE plpgsql;
-- Function to validate geometry of all tables.
-- To run it after creating the function simply run SELECT validate_geom();
-- Function to validate geometry of all tables. To run it after creating the function sinmply run Select validate_geom();
CREATE OR REPLACE FUNCTION validate_geom() RETURNS void AS CREATE OR REPLACE FUNCTION validate_geom() RETURNS void AS
$BODY$ $BODY$
DECLARE osm_tables CURSOR FOR DECLARE osm_tables CURSOR FOR
@ -34,9 +31,8 @@ DECLARE osm_tables CURSOR FOR
BEGIN BEGIN
FOR osm_table IN osm_tables LOOP FOR osm_table IN osm_tables LOOP
EXECUTE 'UPDATE ' || quote_ident(osm_table.table_name) || ' SET EXECUTE 'UPDATE ' || quote_ident(osm_table.table_name) || ' SET
geometry = ST_MakeValid(geometry) where ST_isValidreason(geometry) = ''F'' ;'; geometry = ST_MakeValid(geometry) where ST_IsValidReason(geometry) = ''F'' ;';
END LOOP; END LOOP;
END; END;
$BODY$ $BODY$
LANGUAGE plpgsql; LANGUAGE plpgsql;

Plik diff jest za duży Load Diff