[postgis-users] Create View problem

Micha Silver micha at arava.co.il
Fri May 20 02:51:04 PDT 2011


On 05/19/2011 10:36 PM, Clay, Bruce wrote:
>
> This is probably a question for the QGis folks but I wanted to check 
> here first where ther is likely a larger audience.
> I create several spatial tables using PostGis and all are visible in 
> QGis on their own.
> When I create a view in PostGis that reaches into a variety of tables 
> I see the name of the view in QGis but the type is "Waiting" and I get 
> an error indicating that QGis can not load the data because it is 
> "unable to determine srid and column shape in <view name>" then it 
> shows an error <view name>(shape) sql is an invalid layer.


You probably need to create an entry in the geometry_columns table for 
this new view. Something like:

INSERT INTO geometry_columns  \
          
(f_table_catalog,f_table_schema,f_table_name,f_geometry_column,srid,type,coord_dimension)  
\
          VALUES (....);

or even better, use the PostGIS function addgeometrycolumn()

> The SQL is used to create the view follows:
> CREATE OR REPLACE VIEW mission_data.S1_objects AS
>     select M1.object_name, M2.center_lat, m2.center_lon, M2.scene_id, 
> M2.OID,
>     ST_Transform(M2.shape,4326) as shape  from 
> mission_data.mission_info M1
>     join mission_data.objects M2 ON  M1.object_name = M2.object_name
>    where M1.mission_name = 'E3 Scenario 1' and M1.list_title = 'Object 
> List';
> and I alos tried a simpler query
> CREATE VIEW mission_data.S1_test AS
>     SELECT OID, ST_Transform(shape,4326) As shape, object_name
>     FROM mission_data.objects;
> but they both gave the same errors
> I did search the QGis forum web site but did not find anything clues 
> or reported issues
> Bruce
>
>
> This mail was received via Mail-SeCure System.
> This message and any enclosures are intended only for the addressee.  Please
> notify the sender by email if you are not the intended recipient.  If you are
> not the intended recipient, you may not use, copy, disclose, or distribute this
> message or its contents or enclosures to any other person and any such actions
> may be unlawful.  Ball reserves the right to monitor and review all messages
> and enclosures sent to or from this email address.
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
> This mail was received via Mail-SeCure System.
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110520/d96f2b1d/attachment.html>


More information about the postgis-users mailing list