diff --git a/CHANGELOG.md b/CHANGELOG.md index b9d0fae4b65c6fdcc30cfa2fb84898185a3c10f3..9e22484de375a1b022e5842425ebb7b3250aec7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ Upcoming version: ----------------- + - fixed problems with deleting of tables in between srid change (Nikolaus Krismer) - fixed a problem when generating db dumps for multiple srids (Nikolaus Krismer) - allowing multiple target_srids now (Nikolaus Krismer) - added information about srid 82344 (Nikolaus Krismer) diff --git a/bootstrap/importData.sh b/bootstrap/importData.sh index ab27e60d69b55dc5864ea5b9347d14d9e65ed737..7ef3a32925d5b064611bcdcaf3d32ff9e5dda61a 100755 --- a/bootstrap/importData.sh +++ b/bootstrap/importData.sh @@ -105,14 +105,14 @@ function fn_import_dataset_postgis() { cp $DOWNLOAD_DIR/$SQL_EXPORT_FILE $DATA_DIR/$SQL_EXPORT_FILE >> /dev/null 2>&1 echo " - importing SQL export into PostGIS database" - gunzip -c $DATA_DIR/$SQL_EXPORT_FILE | PGPASSWORD="$PG_DB_PASSWORD" psql -U "$PG_DB_USER" -h localhost "$PG_DB_NAME" >> "$WORKING_DIR/import_datamodel_$CITY.log" 2>&1 + gunzip -c $DATA_DIR/$SQL_EXPORT_FILE | PGPASSWORD="$PG_DB_PASSWORD" psql -U "$PG_DB_USER" -h localhost "$PG_DB_NAME" >> "$WORKING_DIR/import_datamodel_$CITY_$SRID.log" 2>&1 echo " - getting table permissions" tables=`PGPASSWORD="$PG_DB_PASSWORD" psql -qAt -U "$PG_DB_USER" -h localhost -c "SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tableowner = 'postgres';" "$PG_DB_NAME"` echo " - fixing table permissions" - for tbl in $tables ; do - PGPASSWORD="$PG_DB_PASSWORD" psql -qAt -U "$PG_DB_USER" -h localhost -c "ALTER TABLE $tbl OWNER TO $PG_DB_USER" "$PG_DB_NAME"; + for tbl in $tables; do + PGPASSWORD="$PG_DB_PASSWORD" psql -qAt -U "$PG_DB_USER" -h localhost -c "ALTER TABLE $tbl OWNER TO $PG_DB_USER" "$PG_DB_NAME" done fi @@ -124,20 +124,22 @@ function fn_import_dataset_postgis() { if $AVAILABLE_ISOCHRONE_DATAMODEL && [ ! -f "$DATA_DIR/$SQL_EXPORT_FILE" ]; then echo " - creating datamodel using isochrone-datamodel" # Create datamodel using isochrone-datamodel project - DB_USERNAME="$PG_DB_USER" DB_PASSWORD="$PG_DB_PASSWORD" "$DEPLOY_DIR/isochrone-datamodel/builder.sh" -d -s -b -l -t${SRID} -c${CITY} >> "$WORKING_DIR/create_datamodel_$CITY.log" 2>&1 + DB_USERNAME="$PG_DB_USER" DB_PASSWORD="$PG_DB_PASSWORD" "$DEPLOY_DIR/isochrone-datamodel/builder.sh" -d -s -b -l -t${SRID} -c${CITY} >> "$WORKING_DIR/create_datamodel_$CITY_$SRID.log" 2>&1 echo " - copying tables to isochrone database" - PGPASSWORD="spatial" pg_dump -U spatial -h localhost -p 5432 -d spatial --clean --if-exists --no-privileges --no-owner -t "transformed.${CITY}_*" | sed -e "s/transformed/public/g" | PGPASSWORD="$PG_DB_PASSWORD" psql -h localhost -U "$PG_DB_USER" -p 5432 -d isochrone >> "$WORKING_DIR/create_datamodel_$CITY.log" 2>&1 + # If working with multiple TARGET_SRIDs we have to delete an eventually existing nodes_density table here, so on import later a DROP TABLE ${CITY}_nodes works wihtout CASCADE (pg_dump does not use CASCADE) + PGPASSWORD="$PG_DB_PASSWORD" psql -qAt -U "$PG_DB_USER" -h localhost -d isochrone -c "DROP TABLE IF EXISTS ${CITY}_nodes_density" >> "$WORKING_DIR/create_datamodel_$CITY_$SRID.log" 2>&1 + PGPASSWORD="spatial" pg_dump -U spatial -h localhost -d spatial --clean --if-exists --no-privileges --no-owner -t "transformed.${CITY}_*" | sed -e "s/transformed/public/g" | PGPASSWORD="$PG_DB_PASSWORD" psql -U "$PG_DB_USER" -h localhost -d isochrone >> "$WORKING_DIR/create_datamodel_$CITY_$SRID.log" 2>&1 fi if $AVAILABLE_POSTGIS && $AVAILABLE_ISOCHRONE_TOOLS; then - java -cp $DOWNLOAD_DIR/isochrone-tools.jar at.uibk.dbis.isochrone.generator.density.DensityGenerator -t "$CITY" -d 60,120,180,240,300 >> "$WORKING_DIR/create_datamodel_$CITY.log" 2>&1 + java -cp $DOWNLOAD_DIR/isochrone-tools.jar at.uibk.dbis.isochrone.generator.density.DensityGenerator -t "$CITY" -d 60,120,180,240,300 >> "$WORKING_DIR/create_datamodel_$CITY_$SRID.log" 2>&1 fi if $AVAILABLE_ISOCHRONE_DATAMODEL; then # Exporting resulting database to $DATA_DIR - echo " - exporting database dump for ${CITY}" - PGPASSWORD="$PG_DB_PASSWORD" pg_dump -U "$PG_DB_USER" -h localhost -p 5432 -d isochrone --clean --compress=5 --if-exists -t "${CITY}_*" --file="$DATA_DIR/$SQL_EXPORT_FILE" >> "$WORKING_DIR/create_datamodel_$CITY.log" 2>&1 + echo " - exporting database dump" + PGPASSWORD="$PG_DB_PASSWORD" pg_dump -U "$PG_DB_USER" -h localhost -d isochrone --clean --compress=5 --if-exists -t "${CITY}_*" --file="$DATA_DIR/$SQL_EXPORT_FILE" >> "$WORKING_DIR/create_datamodel_$CITY_$SRID.log" 2>&1 fi } @@ -198,7 +200,7 @@ function fn_import_spatialite() { if $AVAILABLE_GDAL && [ ! -f "$DATA_DIR/$SPATIALITE_FILENAME" ]; then echo "Exporting PostGIS data into spatialite database" - $DEPLOY_DIR/gdal/apps/ogr2ogr --config PG_LIST_ALL_TABLES YES --config PG_SKIP_VIEWS YES -progress -f "SQLite" "$DATA_DIR/$SPATIALITE_FILENAME" PG:"host=localhost dbname=isochrone user=$PG_DB_USER password=$PG_DB_PASSWORD" -lco LAUNDER=yes -dsco SPATIALITE=yes -lco SPATIAL_INDEX=yes -gt 65536 >> "$WORKING_DIR/setup_spatialite.log" 2>&1 + $DEPLOY_DIR/gdal/apps/ogr2ogr --config PG_LIST_ALL_TABLES YES --config PG_SKIP_VIEWS YES -progress -f "SQLite" "$DATA_DIR/$SPATIALITE_FILENAME" PG:"host=localhost dbname=isochrone user=$PG_DB_USER password=$PG_DB_PASSWORD" -lco LAUNDER=yes -dsco SPATIALITE=yes -lco SPATIAL_INDEX=yes -gt 65536 >> "$WORKING_DIR/import_spatialite.log" 2>&1 fi if [ -f "$DATA_DIR/$SPATIALITE_FILENAME" ]; then