[Mapserver-users] PostGIS subselect & where'd the data go?

Jan Hartmann jhart at frw.uva.nl
Fri Apr 25 07:56:23 PDT 2003


Charlton,

When you put an SQL request to PostGIS  using a table name, all fields 
in that table are automatically returned to MapServer, alongside the 
geometry field. That's why you see "dataset", "source", etc in the 
result, although you did not specify them in the DATA statement. In a 
subselect however, you have to request *every* field you need (including 
oid).  There is no default set of fields in a subselect.

Jan

Charlton Purvis wrote:

>So here are the two cases that should have the same results but don't.
>
>// CONTROL (no subselecting)
>   $layerObj->set("data","the_geom from se_bathy");
>
>// The TEST case is when I run my .php w/ this, instead:
>   $layerObj->set("data","the_geom from "
>   . "(select oid, the_geom FROM se_bathy where 1=1) "
>   . "AS foo USING UNIQUE oid USING SRID=-1");
>  
>
...
...

>CONTROL results
># results = 739 from bathy_postgis
>Data fields: | gid | dataset | source | res | depth_ft | depth_m |
>depth_fa |
>
>TEST results
># results = 739 from bathy_postgis
>Data fields: | oid |
>  
>
Jan Hartmann
Department of Geography
University of Amsterdam
jhart at frw.uva.nl




More information about the MapServer-users mailing list