[postgis-users] postgis through views

Lionel Bargeot l.bargeot at educagri.fr
Thu Oct 27 23:44:57 PDT 2005


in mapfile, you have to "help" Mapserver to find a unique column and a
SRID for the view.

If you use a view, you have lost 
- oid as writen in prvious mail
- srid
This is the usual information mapserver find in the geometry-column table.

In the layer section , you will have to define the data parameter like
this :

DATA "geom from r200408_wet_fill" USING UNIQUE oid USING SRID=your_srid

oid must be added in the view definition (or any other unique item.



PostGIS Users Discussion <postgis-users at postgis.refractions.net> le
Vendredi, Octobre 28, 2005 à 2:31 AM  a écrit :

>> We're trying to use PostGIS through a VIEW with Mapserver.  We have two 
>> identical tables, one being accessed natively and one through a VIEW
>> CREATE VIEW r200408_wet_fill as select * from r2004_wet_fill.
>> Things seem to not be working.  Are there any known problems for using 
>> VIEWs with PostGIS?
>Postgres (generally) uses an internal column (oid) in each table to
>number each row. Unless explicitly stated, your view will not have the oid
>column. From the mapserver error message, it suggests that mapserver uses
>column, hence the error with your view.
>So create your view as: 
>CREATE VIEW r200408_wet_fill as select oid, * from r2004_wet_fill
>to ensure your view contains the oid column. 
>I don't know this for sure, but if mapserver uses the oid, there may be
>performance benefits to indexing the oid column in the underlying table.
>anyone know this for sure? (Postgres does NOT index the oid by default).
>One other aspect of views on spatial tables relates to the
>table. When you add a spatial (geometry) column to a table, an entry in
>geometry_columns table is created, which describes the new spatial
>column. Your
>view will not have an entry in this table (but the underlying table will).
>I don't know about mapserver, but some applications do refer to this
>table to
>identify tables with geometry columns. So creating an entry in this table
>your spatial views may also resolve some problems.
>  Brent Wood  
>postgis-users mailing list
>postgis-users at postgis.refractions.net

Lionel Bargeot
Agrogeomatic      http://www.igcs-stb.org/
4 rue Champs-prevois, bat grand-champs, 21000 Dijon

More information about the postgis-users mailing list