File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -61,13 +61,18 @@ import() {
6161 local file=" $3 "
6262 local inlayer=" $4 "
6363
64+ # Spatial index is created manually after import, because otherwise
65+ # the index names generated by ogr2ogr clash with the preexisting index.
66+
6467 ogr2ogr -f PostgreSQL " PG:dbname=$db " -overwrite -nln " ${layer} _new" \
6568 -lco GEOMETRY_NAME=geom \
6669 -lco FID=id \
70+ -lco SPATIAL_INDEX=NONE \
6771 -sql ' select "_ogr_geometry_" from ' " $inlayer " \
6872 " /vsizip/$file .zip/$file "
6973
7074 psql --quiet -d " $DB " -c " ANALYZE ${layer} _new;"
75+ psql --quiet -d " $DB " -c " CREATE INDEX ON ${layer} _new USING GIST (geom);"
7176 psql --quiet -d " $DB " -c " BEGIN; DROP TABLE IF EXISTS $layer ; ALTER TABLE ${layer} _new RENAME TO $layer ; COMMIT;"
7277}
7378
You can’t perform that action at this time.
0 commit comments