postgis table joins in layer DATA and FILTER

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Fri Nov 30 18:56:00 EST 2007


David Niergarth wrote:
> Hi Steve,
> 
> Stephen Woodbridge wrote:
>> Try this:
>>
>> DATA "the_geom from (select the_geom, name, checked, gid from sm100k 
>> a, files b where a.uid=b.uid ) as foo using SRID=4326 using unique gid"
>>
>> You have to put your joins into a sub-select.
> 
> Ah! Using an anonymous table, the join is now working. I'm still 
> figuring out the "using unique gid" bit at the end. Is gid like an oid 
> for geometry tables? My table has no gid column. Is that something I can 
> add?
> 
> Gold coins for you!
> 
> --David

gid is a just a unique column, you can use and primary key or unique 
column the is an integer. Mapserver expects it in case you want to do a 
query so if you don't have one just add a serial column to one of you 
tables and reference it.

-Steve



More information about the mapserver-users mailing list