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 "------------------------------------------------------------------"
@docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) ps
build:
@echo
@echo "------------------------------------------------------------------"
@ -129,15 +128,14 @@ validate_geom: validate_geom
@echo "------------------------------------------------------------------"
@echo "Validating geom for all tables"
@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
@echo
@echo "------------------------------------------------------------------"
@echo "Clip tables using the clip layer"
@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'
- 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
- CLIP=yes
- CLIP=no
osmupdate:
build: docker-osmupdate

Wyświetl plik

@ -101,7 +101,7 @@ class Importer(object):
msg = 'QGIS_STYLE not supported : %s' % self.default['QGIS_STYLE']
self.error(msg)
else:
self.info('Qgis style: ' + self.default['QGIS_STYLE'])
self.info('QGIS style: ' + self.default['QGIS_STYLE'])
# Check folders.
folders = ['IMPORT_QUEUE', 'IMPORT_DONE', 'SETTINGS', 'CACHE']
@ -204,9 +204,7 @@ class Importer(object):
self.default['POSTGRES_PASS']))
self.cursor = connection.cursor()
except OperationalError as e:
print(stderr.write(e))
exit()
self.error(e)
self.postgis_uri = 'postgis://%s:%s@%s/%s' % (
self.default['POSTGRES_USER'],
@ -246,7 +244,7 @@ class Importer(object):
command += ['-d', self.default['POSTGRES_DBNAME']]
command += ['-f', self.clip_sql_file]
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):
"""Perform clipping if the clip table is here."""

Wyświetl plik

@ -18,11 +18,8 @@ END;
$BODY$
LANGUAGE plpgsql;
-- Function to validate geometry of all tables. To run it after creating the function sinmply run Select validate_geom();
-- Function to validate geometry of all tables.
-- To run it after creating the function simply run SELECT validate_geom();
CREATE OR REPLACE FUNCTION validate_geom() RETURNS void AS
$BODY$
DECLARE osm_tables CURSOR FOR
@ -34,9 +31,8 @@ DECLARE osm_tables CURSOR FOR
BEGIN
FOR osm_table IN osm_tables LOOP
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;
$BODY$
LANGUAGE plpgsql;