[postgis-users] View Question

Heiko Kehlenbrink heiko.kehlenbrink at vermes.fh-oldenburg.de
Fri Nov 29 05:22:43 PST 2002


Joao Brezolin wrote:

> Hello to all
>
>I'm using PostGIS and Mapserver  versions 0.7.3 and 
>3.6.3.
>
>I'm tried to create a view  from the main table and
>call it in the mapfile, but it doesn't work....
>
>The code is this:
>
>LAYER
> CONNECTIONTYPE postgis
> NAME Roads
> CONNECTION "user=postgres dbname=dbase"
> DATA "geometry_field  from table_view"
> FILTER "id_sec=1"
> STATUS  ON
> TYPE LINE
>#  LABELITEM "tile_name"
> CLASS
>  NAME "Road 1"
>  TEMPLATE "Road_1.html"
>  EXPRESSION ([tipo_log]=2)
>  COLOR 85 85 85
>  SYMBOL 'line'
>  SIZE 10
>  MINSIZE 3
>  MAXSIZE 15
>  OVERLAYCOLOR 168 168 0
>  OVERLAYSYMBOL 0
>  OVERLAYSIZE 3
>  OVERLAYMINSIZE 1
>  OVERLAYMAXSIZE 2
>  SIZE 15
> # LABEL
> #  TYPE truetype
> #  FONT arial-bold
> #  SIZE 14
> #  ANTIALIAS
> #  COLOR 0 0 0
> #  OUTLINECOLOR 255 255 255
> #  PARTIALS OFF
> END
> CLASS
>   NAME "Road"
>   TEMPLATE "Road_2"
>   EXPRESSION ([tipo_log]=1)
>   COLOR 85 85 85
>   SYMBOL 'line'
>   SIZE 5
>   MINSIZE 3
>   MAXSIZE 15
>   OVERLAYCOLOR 255 255 255
>   OVERLAYSYMBOL 0
>   OVERLAYSIZE 3
>   OVERLAYMINSIZE 1
>   OVERLAYMAXSIZE 2
>   SIZE 15
> END
>END
>
>when i execute the following error apears:
>
>msPOSTGISLayerWhichShapes(): Query error.
>prep_DB:Error executing POSTGIS DECLARE statement (0.6
>failed - retried 0.5 and it failed too). DECLARE
>mycursor BINARY CURSOR FOR SELECT
>tipo_log::text,asbinary(force_collection(force_2d(geometry_field)),'NDR'),OID::text
>from table_view WHERE (id_sec=1) and (geometry_field
>&& setSRID( 'BOX3D(1430.3002 760.3,1730.1002
>1120.3)'::BOX3D,find_srid('','table_view','geometry_field')
>))
>
>How can i add OID and SRID comlumns on this view ?
>
Hi Joao,

I've had also a Problem with using a view in Mapserver.
My fault was that i generated the view as being user "heiko" but calling 
the database from mapserver as user "guest"...
But for your Question afaik you should call the oid in the view like this:

SELECT t0.geometry_field, t0.oid FROM <your_table> t0;

The SRID should be in the geometry_field , so it was in my case 
importing shape-files into postgis.

You could use something like this in your mapfile:

DATA "geometry_field  from table_view using unique oid using srid=<your srid>"

This worked for me but I haven't (couldn't) analysed your error-message...


all the best

Heiko

>
>
>Thanks
>
>João 
>
>_______________________________________________________________________
>Yahoo! Acesso Grátis
>Internet rápida, grátis e fácil. Faça o download do discador agora mesmo.
>http://br.acesso.yahoo.com/
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>






More information about the postgis-users mailing list