We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bb7ed85 commit 82b54cbCopy full SHA for 82b54cb
1 file changed
themes/external/download-and-import.sh
@@ -61,13 +61,18 @@ import() {
61
local file="$3"
62
local inlayer="$4"
63
64
+ # Spatial index is created manually after import, because otherwise
65
+ # the index names generated by ogr2ogr clash with the preexisting index.
66
+
67
ogr2ogr -f PostgreSQL "PG:dbname=$db" -overwrite -nln "${layer}_new" \
68
-lco GEOMETRY_NAME=geom \
69
-lco FID=id \
70
+ -lco SPATIAL_INDEX=NONE \
71
-sql 'select "_ogr_geometry_" from '"$inlayer" \
72
"/vsizip/$file.zip/$file"
73
74
psql --quiet -d "$DB" -c "ANALYZE ${layer}_new;"
75
+ psql --quiet -d "$DB" -c "CREATE INDEX ON ${layer}_new USING GIST (geom);"
76
psql --quiet -d "$DB" -c "BEGIN; DROP TABLE IF EXISTS $layer; ALTER TABLE ${layer}_new RENAME TO $layer; COMMIT;"
77
}
78
0 commit comments