From de87deace12c90bb9e8321067b5e1c8f9efd1571 Mon Sep 17 00:00:00 2001 From: admire Date: Tue, 9 Oct 2018 11:58:49 +0200 Subject: [PATCH 1/2] fix id missing in clip table and skipping importing shapefiles with geometry errors --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 89c5667..1401d48 100644 --- a/Makefile +++ b/Makefile @@ -91,7 +91,7 @@ import_clip: @echo "------------------------------------------------------------------" @echo "Importing clip shapefile into the database" @echo "------------------------------------------------------------------" - @docker exec -t -i $(PROJECT_ID)_imposm /usr/bin/ogr2ogr -lco GEOMETRY_NAME=geom -nlt PROMOTE_TO_MULTI -f PostgreSQL PG:"host=db user=docker password=docker dbname=gis" /home/settings/clip/clip.shp + @docker exec -t -i $(PROJECT_ID)_imposm /usr/bin/ogr2ogr -progress -skipfailures -lco GEOMETRY_NAME=geom -nlt PROMOTE_TO_MULTI -f PostgreSQL PG:"host=db user=docker password=docker dbname=gis" /home/settings/clip/clip.shp -sql "SELECT *, 1 as id from clip" remove_clip: @echo From 113fc38fcdb7d352e69396db181fb5067bd98fd8 Mon Sep 17 00:00:00 2001 From: admire Date: Sat, 13 Oct 2018 07:10:26 +0200 Subject: [PATCH 2/2] fix clip id error in the sql --- Makefile | 2 +- settings/clip/clip.sql | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1401d48..ee98e83 100644 --- a/Makefile +++ b/Makefile @@ -91,7 +91,7 @@ import_clip: @echo "------------------------------------------------------------------" @echo "Importing clip shapefile into the database" @echo "------------------------------------------------------------------" - @docker exec -t -i $(PROJECT_ID)_imposm /usr/bin/ogr2ogr -progress -skipfailures -lco GEOMETRY_NAME=geom -nlt PROMOTE_TO_MULTI -f PostgreSQL PG:"host=db user=docker password=docker dbname=gis" /home/settings/clip/clip.shp -sql "SELECT *, 1 as id from clip" + @docker exec -t -i $(PROJECT_ID)_imposm /usr/bin/ogr2ogr -progress -skipfailures -lco GEOMETRY_NAME=geom -nlt PROMOTE_TO_MULTI -f PostgreSQL PG:"host=db user=docker password=docker dbname=gis" /home/settings/clip/clip.shp remove_clip: @echo diff --git a/settings/clip/clip.sql b/settings/clip/clip.sql index e8a5838..f15ae55 100644 --- a/settings/clip/clip.sql +++ b/settings/clip/clip.sql @@ -11,8 +11,7 @@ BEGIN EXECUTE 'DELETE FROM ' || quote_ident(osm_table.table_name) || ' WHERE osm_id IN ( SELECT DISTINCT osm_id FROM ' || quote_ident(osm_table.table_name) || ' - LEFT JOIN clip ON ST_Intersects(geometry, geom) - WHERE clip.id IS NULL) + LEFT JOIN clip ON ST_Intersects(geometry, geom)) ;'; END LOOP; END;