<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV>Thanks for the suggestions.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Unfortunately neither one of them worked.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>1) The CLASSITEM seems not to be the problem. At least when I took it away it still didn't use the the EXPRESSION.</DIV><DIV><BR class="khtml-block-placeholder"></DIV>2) For the NATURAL JOIN I get an error message. (Postgresql reports the error as 'ERROR: syntax error at or near "ON" at character 251 '). But the LEFT JOIN seems to work and when I run the query directly in the database the result looks correct.<DIV><BR class="khtml-block-placeholder"></DIV><DIV>I tried to play a bit around, but without success...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Just to be sure that I understand it correctly: the EXPRESSION parameter references to the alias in the SELECT statement, no? So if I have </DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><B>regions_view.name AS name</B></DIV><DIV>then my</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><B>EXPRESSION ([name] ne 'Africa')</B></DIV><DIV>is based on the alias...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Gush, I am really stuck there...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Stef</DIV><DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR><DIV><DIV>On Feb 22, 2006, at 10:14 PM, Clint Johnson wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV>I believe your script is failing at the DATA clause -- or because there exists no data within your tables that is join-able.</DIV><DIV><BR></DIV><DIV>*[Malformed DATA clause]*</DIV><DIV>I've run into a similar problem myself before.</DIV><DIV><BR></DIV><DIV>I am pretty sure your problem is with your DATA statement.  In fact it may be throwing an exception that you haven't been able to see (rather than ignoring the expression).</DIV><DIV><BR></DIV><DIV>See the advanced-usage at:  <A href="http://postgis.refractions.net/docs/ch04.html#id2789268">http://postgis.refractions.net/docs/ch04.html#id2789268</A></DIV><DIV>Note that the SQL used within the DATA tag is "pseudo-SQL"</DIV><DIV><BR></DIV><DIV>Do not use the WHERE clause to perform your join; instead, use the NATURAL JOIN operator.  Instead, only use the WHERE clause to filter upon items as you would with the FILTER tag (such as regions_view.name = 'foo').  I believe the FILTER and WHERE clauses to be coupled (which further complicates matters when doing a complex join in your DATA clause).</DIV><DIV><BR></DIV><DIV>Therefore, try this and let me know if it works:</DIV><DIV><BR></DIV><DIV>DATA "the_geom FROM (SELECT countries.the_geom AS the_geom, regions_view.name AS name, countries.oid AS oid FROM countries NATURAL JOIN regions_view ON countries.geo_region = regions_view.id) AS foo using unique oid using srid=-1"</DIV><DIV><BR></DIV><DIV>*[Nothing to join]*</DIV><DIV>Perhaps there is nothing to join -- in that case try using LEFT JOIN instead of the NATURAL JOIN</DIV><DIV><BR></DIV><DIV>Clint</DIV><DIV><BR></DIV><DIV><BR></DIV><DIV>Stefan Schwarzer wrote:</DIV> <BLOCKQUOTE type="cite"><DIV>Hi,</DIV><DIV><BR></DIV><DIV>I migrated from mysql to postgres/postgis and update now all my map-queries. But I have a problem getting it working. I wonder if this is a major problem or some minor issue. The doc says :</DIV><DIV>*</DIV><DIV>*</DIV><DIV>*"**Logical expressions allow you to build fairly complex tests based on one or more attributes and therefore are only available with shapefiles"*</DIV><DIV><BR></DIV><DIV>So, i would almost presume that using EXPRESSIONS is not possible via postgis. But I can't imagine that this is true... In the moment it runs the query but with no result - meaning that it "ignores" the epression. I couldn't find anything similar in the archives either...</DIV><DIV><BR></DIV><DIV><BR></DIV><DIV>LAYER</DIV><DIV>NAME bg_shape</DIV><DIV>CONNECTIONTYPE postgis</DIV><DIV>CONNECTION 'user=xxx password=xxx dbname=xxx'</DIV><DIV>TYPE POLYGON</DIV><DIV>DATA 'the_geom FROM (SELECT countries.the_geom AS the_geom, regions_view.name AS name, countries.oid AS oid FROM countries, regions_view WHERE countries.geo_region = regions_view.id) AS foo USING UNIQUE oid USING srid=-1'</DIV><DIV>CLASSITEM 'name'</DIV><DIV>CLASS</DIV><DIV>NAME '' EXPRESSION ([name] ne 'Africa')</DIV><DIV>OUTLINECOLOR 230 230 230</DIV><DIV>COLOR 230 230 230</DIV><DIV>END</DIV><DIV>END  # LAYER</DIV><DIV><BR></DIV><DIV><BR></DIV><DIV>Thanks for any help!</DIV><DIV><BR></DIV><DIV>Stef</DIV><DIV><BR></DIV> </BLOCKQUOTE><DIV><BR></DIV><DIV><BR></DIV><DIV>-- </DIV><DIV>Clint Johnson</DIV><DIV>Refractions Research Inc.</DIV><DIV><A href="mailto:Cjohnson@refractions.net">Cjohnson@refractions.net</A></DIV> </BLOCKQUOTE></DIV><BR></DIV></DIV></BODY></HTML>