fix typo and launching of docker-osm when we do not have clip shapefile by default

pull/86/head
Etienne Trimaille 2019-09-20 22:53:05 +02:00 zatwierdzone przez Étienne Trimaille
rodzic 446d9fadf5
commit f13395933a
4 zmienionych plików z 9 dodań i 17 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

@ -73,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

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;