[GRASS-user] v.in.ogr access PostGIS view

Sebastian P. Luque spluque at gmail.com
Wed Dec 19 11:18:44 PST 2012

On Tue, 11 Dec 2012 11:05:55 +0100,
Moritz Lennert <mlennert at club.worldonline.be> wrote:

> On 01/12/12 04:53, Seb wrote:
>> Hi,

>> It seems as if v.in.ogr cannot access views:

>>> v.in.ogr dsn="PG:dbname=gshhs" -l
>> Data source contains 6 layers: gshhs_c_l1, gshhs_f_l1, gshhs_h_l1,
>> gshhs_i_l1, gshhs_l_l1, regions

>> but these are only tables.  The database has a number of views that
>> I'd like to access, but they are not listed.  Is this a limitation in
>> v.in.ogr?  Thanks.

> AFAIK, this comes directly from OGR, not from GRASS. IIUC you have to
> add the view manually to geometry_columns in your database for it to
> show up in the list. However, you should be able to access views
> directly through their name. Check [1] for more info, notably the
> section on "Named views".

> Moritz

> [1] http://www.gdal.org/ogr/drv_pg_advanced.html

Thanks Moritz, setting PG_LIST_ALL_TABLES=YES did allow access to the
views (I wasn't able to do that without it).  I guess that registering
the view in the geometry_columns table allows OGR to gather SRS and
geometry type info.  In fact, I had to use the -o flag in v.in.ogr to
skip the projection check.


More information about the grass-user mailing list