[postgis-tickets] [SCM] postgis.net branch website updated. clarity-final-20-ga321833

git at osgeo.org git at osgeo.org
Wed May 24 12:24:52 PDT 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "postgis.net".

The branch, website has been updated
       via  a3218338cb5d08ce61c1e509bb5ef8fb50ec0318 (commit)
      from  c535830c6eddb68d0be21e088ce45bc8c1b46db0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a3218338cb5d08ce61c1e509bb5ef8fb50ec0318
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed May 24 12:24:46 2023 -0700

    Add raster FAQ entry

diff --git a/content/documentation/faq/raster-inout.md b/content/documentation/faq/raster-inout.md
new file mode 100644
index 0000000..e9b02ac
--- /dev/null
+++ b/content/documentation/faq/raster-inout.md
@@ -0,0 +1,61 @@
+---
+title: "How do I import/export raster data?"
+date: 2023-05-23
+draft: false
+geekdocHidden: true
+geekdocHiddenTocTree: false
+tags: [raster, gdal]
+---
+
+## Importing Data
+
+You can import raster data using either `raster2pgsql`, which is part of the PostGIS distribution, or `gdal_translate`, which is part of [GDAL](https://gdal.org).
+
+The `raster2pgsql` is usually easier for loading, as the [options for controlling the load](https://postgis.net/docs/using_raster_dataman.html#RT_Loading_Rasters) are exposed directly.
+
+## Exporting Data
+
+The `gdal_translate` utility is usually easier for exporting raster data.
+
+```
+PGHOST=localhost \
+PGPORT=5432 \
+PGUSER=postgres \
+PGPASSWORD=password \
+gdal_translate \
+    -of PNG \
+    -outsize 10% 10% \
+    "PG:dbname=db table=tbl" \
+    foo.png
+```
+
+You can also use SQL "where" clauses in your export, adding the filter you would like to be placed after the "where" into your connection string. Note that the single quotes in the filter have been artfully escaped.
+
+```
+PGHOST=localhost \
+PGPORT=5432 \
+PGUSER=postgres \
+PGPASSWORD=password \
+gdal_translate \
+    -of PNG \
+    -outsize 10% 10% \
+    "PG:dbname=db table=tbl where='filename=\'abcd.sid\'' " \
+    outfile.png
+```
+
+You can also use spatial filters in the "where" clause.
+
+```
+PGHOST=localhost \
+PGPORT=5432 \
+PGUSER=postgres \
+PGPASSWORD=password \
+gdal_translate \
+    -of PNG \
+    -outsize 10% 10% \
+    "PG:dbname=db table=tbl where='ST_Intersects(rast, ST_SetSRID(ST_Point(-71.0,42.3),4326))' " \
+    outfile.png
+```
+
+
+

-----------------------------------------------------------------------

Summary of changes:
 content/documentation/faq/raster-inout.md | 61 +++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 content/documentation/faq/raster-inout.md


hooks/post-receive
-- 
postgis.net


More information about the postgis-tickets mailing list