Filter layer with MS/SQL based attribute ?

Frank Warmerdam fwarmerdam at GMAIL.COM
Tue Aug 23 08:50:36 EDT 2005


On 8/23/05, Lars V. Nielsen (Hvenegaard) <LVN at hvenegaard.dk> wrote:
> I have an OGR based polygon table with just a numeric ID attached. I'm
> displaying this in the map, it's working fine.
> 
> A non-geographical table in MS/SQL has a table with this ID as key, and an
> attribute to tell whether the entry is active or not (null if active).
> 
> I've tried to use a JOIN and a FILTER in my layer to implement the
> filtering, but I'm somehow not getting it right. And the docs are rather
> scarce on examples.
> 
> Can anyone give a fast rundown on how to do this ?
>
> Is JOIN+FILTER even the way to accomplish this ?

Lars,

Are you accessing your MS/SQL non-geographical table through
OGR as well?  Are you using an OGR SQL JOIN or a MapServer
JOIN?  

OGR SQL joins do not permit WHERE queries on joined fields.
The WHERE clause is currently evaluated on the primary table
before the join is done.  I *suspect* that is the problem you are
running into though you haven't really provided enough details
to make it clear. 

If your polygon data is in MS/SQL too then I suspect the best
way to organize things is executing a custom SQL query doing
the join and WHERE all within MS/SQL.  

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-users mailing list