postgis views?

Jeff McKenna jmckenna at DMSOLUTIONS.CA
Fri Nov 10 10:20:59 EST 2006


The other day I too faced this issue with MapServer/PostGIS/views.  I 
found a post on the list to make sure postgresql.conf is set to generate 
oids ("default_with_oids = on").  Setting that (with PostgreSQL 8.1.5) 
and regenerating my tables solved my problem.

jeff




Pietro Giannini wrote:
> Ciao Paolo,
> 
> I'm normally working with php/mapscript applications and I use data from
> Postgres/postgis db, dinamically changing the data source of a layer from
> a table to a view, and I have similar problems, resolved as follows.
> 
> In the .map file the "data" of layer is like this:
>      "<geometry_column> FROM <table>"
> and that work fine.
> 
> Instead, If I change the data source to a view I must to add the statement
> "USING UNIQUE <id>" where <id> is the primary key of the table, added to
> the view.
> In other words: the view must contain the pk of the table, e.g. "SELECT
> <geometry_column>, <id> FROM <table>", and the "data" string of the
> mapserver layer must contain the "USING UNIQUE" statement, looking like:
>      "<geometry_column> FROM <view> USING UNIQUE <id>"
> I believe mapserver is automatically looking for a field named "oid" that
> is normally provided from a postgis table but not from a view (or a
> sub-query), so you must to specify the name of the pk field in view.
> 
> let me know!
> 
> ciao
> 
> ___________________________
>       Pietro Giannini
>   Bytewise srl - Area GIS
> 41°50'38.58"N 12°29'13.39"E
> 
> 
> 
> On Ven, 10 Novembre 2006 11:25, Paolo Cavallini disse:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi all,
>> we are not able to use in mapserver data from postgres/postgis views,
>> even if the_geom column of view was add to the geometry_column table).
>> Anybody had a similar problem?
>> All the best.
>> pc
>> - --
>> Paolo Cavallini
>> email+jabber: cavallini at faunalia.it
>> www.faunalia.it
>> Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy   Tel: (+39)348-3801953
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.5 (GNU/Linux)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iD8DBQFFVFOc/NedwLUzIr4RAlGlAKCxgZas03i0njogMrMjoMSoGVKf6ACgrNNT
>> TKMptXmeFJrlbiHVsuxCBMk=
>> =8sLR
>> -----END PGP SIGNATURE-----
>>

-- 
Jeff McKenna
DM Solutions Group Inc.
http://www.dmsolutions.ca



More information about the mapserver-users mailing list