Relatively new to PostGIS and I am currently exploring the options to make one of my PostgreSQL Tables spatial. Essentially I want to store a raster object in a table that also contains essential metadata. Every raster in the database has to be uniquely linked to the ID´s and information stored in the table.
I was under the impression that I could just write the raster into the same table (similar as with vectors where I could just add geometry columns)? With a query like this I can only write a raster to a new (non-existing) table, thus creating hundreds of tables if my raster files vary in extent, origin and projection (very likely).:
raster2pgsql -s 32739 -I -C -F -M -Y myfile.tif -t 100x100 Map > rasQuery.sql psql -U test -h localhost -d test -f rasQuery.sql
My existing table looks like this, where I created a raster column.
CREATE TABLE Map( id serial PRIMARY KEY, second_id INT references AreaOfInterest, RasterFile raster, RasterType char(250), RasterAuthor char(250), Acquisition date, );
- What is the standard way to load and link rasters with existing tables?
raster2psqlfails for me stating that the table map already exists, so I guess I have to specify a column as well? Or did I miss a mandatory command here?
The currently working alternative for me would be to just store the filepath in a text column in the Map Table.
Running PostgreSQL 9.4dev + PostGIS 2. on Debian Linux in a test-environment.
EDIT: I am already a bit further. After adding
rast raster, filename raster,
to my table and the
-a flag in front of map in the
raster2pgsql command it returns some new errors.
Now it says:
rt_raster_from_wkb: wkb size (9) < min size (61) CONTEXT: COPY map, row 1, column filename: „myfile.tif“