[Qgis-user] Adding PostGIS views to the map

Lee Hachadoorian Lee.Hachadoorian+L at gmail.com
Sat May 18 17:59:43 PDT 2013


On 04/17/2013 12:36 PM, Jürgen E. Fischer wrote:
> Hi Lee,
>
> On Wed, 17. Apr 2013 at 12:14:01 -0400, Lee Hachadoorian wrote:
>> As I recall, QGIS used to treat any unique int field as a suitable key for
>> adding a layer, so that views that were registered in the PostGIS
>> geometry_columns table could be added to the map. Now that geometry_columns
>> is a view rather than a table, spatial views are registered automatically.
>> They appear in the tables list in QGIS, but the primary key has to be
>> selected manually (even if they underlying table column is a suitable primary
>> key).  Perhaps I am misremembering that this step was necessary previously,
>> but I wonder if there is any way to avoid it, e.g. by making sure the key
>> column has a specific name, data type, etc?
> There's no specific name or data type required for a key column and a view is
> also not required to have just one (or any) underlying tables - so guessing
> which column might be a unique is not that easy.
>
>
> Jürgen

Just came across this screencast 
(http://linfiniti.com/2013/04/dynamically-updating-layers-in-qgis-with-postgis-views/) 
from Tim Sutton's linfiniti blog. Note at 1:50, he adds a PostGIS 
spatial view as a layer, but does not have to select the unique column. 
This is the behavior that I thought I remembered. Is there any way I can 
accomplish the same thing?

Using QGIS 1.8 and PostGIS 2.0 on Linux Mint 14.

Best,
--Lee

-- 
Lee Hachadoorian
Assistant Professor in Geography, Dartmouth College
http://freecity.commons.gc.cuny.edu




More information about the Qgis-user mailing list