[GRASS-user] Export raster to PostGIS

Stefan Blumentrath Stefan.Blumentrath at nina.no
Sun Aug 28 06:27:37 PDT 2022


Hi Asim,

You could try to use raster2pgsql after making sure you have the GDAL-GRASS plugin installed.

Then you should be able to load GRASS GIS raster maps directly into PostGIS by pointing to the header of your GRASS GIS maps. Something like:
raster2pgsql -s 4326 -C -l 2,4 -I -F -t 2700x2700 /your_grassdb/location/mapset/cellhd/your_raster_map output_pg_shema_name. output_table_name | psql -h your_host -p 5432 -U postgres -d your_pg_database
(obviously you have to adjust options and flags of raster2pgsql to your case...).

Hope that helps.

Cheers
Stefan

-----Original Message-----
From: grass-user <grass-user-bounces at lists.osgeo.org> On Behalf Of Asim via grass-user
Sent: lørdag 27. august 2022 11:38
To: Maris Nartiss <maris.gis at gmail.com>
Cc: grass-user at lists.osgeo.org
Subject: Re: [GRASS-user] Export raster to PostGIS

Hi Māris

Thank you for pointing out the read-only limitation of GDAL library.  A natural workaround is to convert the raster to vector with r.to.vect and then use v.out.postgis.  However, there are some hurdles with regards to the type of resulting geometries (boundary, centroid and area) arising after the conversion to vector.  I will start a separate thread if I can articulate the problem somewhat precisely. 

Asim

_______________________________________________
grass-user mailing list
grass-user at lists.osgeo.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fgrass-user&data=05%7C01%7CStefan.Blumentrath%40nina.no%7Ce039842dbdef478ee35408da880fe04f%7C6cef373021314901831055b3abf02c73%7C0%7C0%7C637971899037805938%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=4KmNrDMDYpVNlHGVghYR86DjRvNf%2BMtT3tMOZ3FFiSs%3D&reserved=0


More information about the grass-user mailing list