postgis views?

Paolo Cavallini cavallini at FAUNALIA.IT
Fri Nov 10 12:12:43 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks to all who replied.
We had the oid on, but it did not work.
What works for us is having a primary key.
All the best.
pc

Jeff McKenna ha scritto:
> 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
- --
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

iD8DBQFFVLML/NedwLUzIr4RAucBAKCYQUbW4LqqfBwVMcwbtb3xYWb1ZQCfVubt
NOTFFbSWpr4VUpgucfuU7Bk=
=Zw5n
-----END PGP SIGNATURE-----



More information about the mapserver-users mailing list