[GRASS-user] PostgreSQL raster and vector import

patrick s. patrick_gis at gmx.net
Thu Feb 4 02:11:46 PST 2016


One finding concerning the variable-based pathdefinition to PostgreSQL 
with schema (thanks to a collegue).
Maybe of interest for other users.

My problems of Raster-import remains open...

Cheers,Patrick

#works
DBPATH="PG:dbname=psql_local"
v.in.ogr input=$DBPATH out=bldg_pt layer=${ISCHEMA}.gws_buildings 
--overwrite

#does not work
INPATH="PG:dbname=psql_local active_schema=baselayer_2000"
v.in.ogr input=$INPATH out=bldg_pt layer=gws_buildings --overwrite

#work
INPATH="PG:dbname=psql_local active_schema=$ISCHEMA"
v.in.ogr "input=$INPATH" out=bldg_pt layer=gws_buildings --overwrite 
#NOTE: "in" needs to be quoted or it will not work


On 04.02.2016 10:44, patrick s. wrote:
> Dear list
>
> In addition to my mail yesterday (see below):
>
> The use of PostGIS might be related to the conversation from octobre 
> last year 
> (http://osgeo-org.1560.x6.nabble.com/External-raster-from-PostGIS-td5231932.html), 
> but it remains unclear to me how to import raster and is not referred 
> to in the manual.
>
> My current state seems close to the solution:
> r.in.gdal in="PG:dbname=psql_local schema=myschema 
> table=reference_map" out=region_ref -o --o #load into grass
> r.external source="PG:dbname=psql_local schema=myschema 
> table=reference_map" out=region_ref --o -o  #link to grass
>
> But both lead to "ERROR: North must be larger than South"
>
> However, I can view the data in QGIS (loading though db-manager) and 
> it appears to be ok.
>
> Is Error it a problem of gdal, my data or the grass-modules? And how 
> can I solve it?
>
> Thanks for any help
> Patrick
>
>
>
> On 03.02.2016 15:48, patrick s. wrote:
>> Dear list
>>
>> I need some help on importing PostGIS raster with r.in.gdal and 
>> schema support under v.in.ogr.
>>
>>
>> RASTER:
>> "r.in.gdal -f" shows support: "PostGISRaster (rw): PostGIS Raster 
>> driver"
>> But I did not find any example on how to formulate the dsn/input.
>>
>>
>> VECTOR:
>> Unfortunately there is no hint in the manual of grass70 on how to 
>> work with schemas (there was one in 64).
>> I had a script in grass64 of following syntax, which is still working:
>>
>> ISCHEMA=baselayer
>> v.in.ogr dsn="PG:dbname=psql_local active_schema=my_dataschema" 
>> layer=gws_buildings --overwrite
>>
>> However, I would like to form this more general as a variable for all 
>> incoming data, which is not working:
>>
>> INPATH="PG:dbname=psql_local active_schema=my_dataschema"
>> v.in.ogr in=$INPATH out=bldg_pt layer=gws_buildings --overwrite
>> =>ERROR: v.in.ogr: Sorry, <active_schema> is not a valid parameter
>>
>> Also the approach described in the manual of grass64 does not work 
>> any longer
>>
>> db.connect driver=pg database=psql_local schema=my_dataschema
>> v.in.ogr in=./ out=bldg_pt layer=gws_buildings --overwrite
>> =>ERROR: Unable to open data source <./>
>>
>>
>> Thanks for any help,
>> Patrick 
>



More information about the grass-user mailing list