Tweak blog content

This commit is contained in:
Sam 2024-08-07 15:31:27 +01:00
parent 8f50994a67
commit 36d489eb8c
1 changed files with 9 additions and 9 deletions

View File

@ -54,15 +54,15 @@ raster2pgsql -d -M -C -I -s 4326 -t 128x128 -F *.tif dem.srtm | psql --dbname=os
{{</ highlight >}} {{</ highlight >}}
Here's a breakdown of the above command: Here's a breakdown of the above command:
- -d This drops an existing table if it already exists. It's useful to include this in case we need to run the command again. - `-d` This drops an existing table if it already exists. It's useful to include this in case we need to run the command again.
- -M This runs `VACUUM ANALYZE` on the table after the raster tiles have been inserted into the database. This optimizes the table by reclaiming storage space and then collecting table statistics. - `-M` This runs `VACUUM ANALYZE` on the table after the raster tiles have been inserted into the database. This optimizes the table by reclaiming storage space and then collecting table statistics.
- -C This applies raster constraints to the table by using the `AddRasterConstraints` function in PostGIS. This adds several types of constraints to the table which ensures data integrity and enforces rules for consistency. - `-C` This applies raster constraints to the table by using the `AddRasterConstraints` function in PostGIS. This adds several types of constraints to the table which ensures data integrity and enforces rules for consistency.
- -I Creates a spatial index (GiST) on the table. - `-I` Creates a spatial index (GiST) on the table.
- -s Assign SRID (Spatial Reference System Identifier) to the raster. - `-s` Assign SRID (Spatial Reference System Identifier) to the raster.
- -t Tile size. This splits the raster into tiles of the specified size. Each tile is a row in the final table. - `-t` Tile size. This splits the raster into tiles of the specified size. Each tile is a row in the final table.
- -F Creates a filename column. As the raster is split into many smaller tiles, this is useful to help us identify the original file the tile belonged to. - `-F` Creates a filename column. As the raster is split into many smaller tiles, this is useful to help us identify the original file the tile belonged to.
- *.tif Selects all of the .tif files in the directory. - ` *.tif` Selects all of the .tif files in the directory.
- dem.srtm Defines the schema and name of the table. Remember to create the `dem` schema in the database before running the command. - `dem.srtm` Defines the schema and name of the table. Remember to create the `dem` schema in the database before running the command.
The `raster2pgsql` command will output a sql query which we can then pipe into the `psql` command. The `raster2pgsql` command will output a sql query which we can then pipe into the `psql` command.