[postgis-users] How to make some geometry column visible to Qgis

Pietro Rossin pierigis at gmail.com
Sun Oct 21 23:40:07 PDT 2012


OK, my view is called puntigronda and is based on a layer storing height of
civil buildings ( 4P000QG_QUOTA_GRONDA). It's geometry column is "the_geom".

SELECT f_table_name, f_geometry_column, srid, type
FROM geometry_columns;

returns:

"gtest";"geom";0;"LINESTRING"
"puntigronda";"the_geom";3004;"POINT"
"entities";"wkb_geometry";3004;"GEOMETRY"

then:

DROP VIEW puntigronda;
DELETE FROM geometry_columns WHERE f_table_name = 'puntigronda';

SELECT f_table_name, f_geometry_column, srid, type
FROM geometry_columns;

returns:

"gtest";"geom";0;"LINESTRING"
"entities";"wkb_geometry";3004;"GEOMETRY"

then:

CREATE OR REPLACE VIEW public.puntigronda AS
 SELECT entities.ogc_fid, ST_TRANSFORM(entities.wkb_geometry,
3004)::geometry(pointz, 3004) as the_geom, entities.layer
   FROM entities
  WHERE entities.layer like '4P000QG_QUOTA_GRONDA';

INSERT INTO geometry_columns (f_table_catalog,f_table_schema, f_table_name,
f_geometry_column, coord_dimension, srid,type)
  VALUES ('','', 'puntigronda', 'the_geom', 3, 3004,'POINTS');

SELECT f_table_name, f_geometry_column, srid, type
FROM geometry_columns WHERE f_table_name = 'puntigronda';

returns:

"puntigronda";"the_geom";3004;"POINT"

and:
SELECT f_table_name, f_geometry_column, srid, type
FROM geometry_columns;

returns:

"gtest";"geom";0;"LINESTRING"
"puntigronda";"the_geom";3004;"POINT"
"entities";"wkb_geometry";3004;"GEOMETRY"

The view puntigronda, as I connect qgis to postgis, is seen as point layer.
Qgis don't need to scan the whole table to understand which geometry type
is in there.
At the same time Qgis takes a lot to scan the view entities (mixed point
and polylines table), so if I want to load the view/layer puntigronda I
have to wait until qgis finish to scan the entities layer.

Is there something wrong?
Thankyou
Pietro


2012/10/19 Pietro Rossin <pierigis at gmail.com>

>
> > >
> > > It works instead..
> > > I saw that "geometry_columns" is a view but the method works.
> >
> > Works at doing what ? It probably just silently does nothing.
>
> If I make the above command and I look into the geometry column view I can
> see a row with my information added.
>
> > What does this return ?
> >
> >   SELECT f_table_name, f_geometry_column, srid, type
> >   FROM geometry_columns WHERE f_table_name = 'pointdata';
>
> I'll try Monday at work..
>
> > > The view created is correctly and immediately seen by qgis that loads
> the
> > > point data.
> > > The only problem is that it takes a year to load it..
> >
> > That's because QGis scans the whole table since it's unable to find
> > the type and srid information in the geometry_column table.
> > Am I wrong ?
> >
>
> No it immediately find the type and srid information.
> In qgis when I open a connection there is a layer called mypointdata and
> it's seen as point feature. When I click on add layer qgis take a lot to
> load it.
> But I think It's a question of data to be loaded.  In fact I tried to make
> a new view with only 2 fields in it and qgis is much more fast on loading
> it.
> Pietro
>
>
> ------------------------------
> View this message in context: Re: How to make some geometry column
> visible to Qgis<http://postgis.17.n6.nabble.com/How-to-make-some-geometry-column-visible-to-Qgis-tp5000570p5000607.html>
>
> Sent from the PostGIS - User mailing list archive<http://postgis.17.n6.nabble.com/PostGIS-User-f3516033.html>at Nabble.com.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121022/ea590298/attachment.html>


More information about the postgis-users mailing list