postgis views?

Pietro Giannini pgiannini at BYTEWISE.IT
Fri Nov 10 09:04:06 EST 2006


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-----
>


___________________________
      Pietro Giannini
  Bytewise srl - Area GIS
41°50'38.58"N 12°29'13.39"E



More information about the mapserver-users mailing list