FILTER working on PostGIS layers?

Constantin Cristian constantin.a.cristian at GMAIL.COM
Sun Jun 19 18:09:08 EDT 2005


You have an syntax error. The parameter of FILTER is what you would 
write after "WHERE".
In your sql query in your case after where you write "20050049" which of 
course can not be evaluated as an boolean value.
You should try something like:
FILTER "identbv=20050049"


Bart van den Eijnden wrote:

>Follow-up on this.
>
>It seems that layer->filter.string only contains the FILTER value and not the whole expression to be used in the where clause.
>
>sprintf(query_string_0_6, "DECLARE mycursor BINARY CURSOR FOR SELECT %s from %s WHERE (%s) and (%s && setSRID( %s,%s) )", columns_wanted, data_source, layer->filter.string, geom_column, box3d, user_srid);
>
>Does this sound familiar to anyone?
>
>Best regards,
>Bart
>
>
>Bart van den Eijnden
>Syncera IT Solutions
>Postbus 270
>2600 AG  DELFT
>
>tel.nr.: 015-7512436
>email: BEN at Syncera-ITSolutions.nl
>
>  
>
>>>>Bart van den Eijnden <BEN at SYNCERA-ITSOLUTIONS.NL> 13-9-2005 13:26:44 >>>
>>>>        
>>>>
>Hi list,
>
>I am running into an issue using Mapscript 4.7 from a few weeks back.
>
>PostGIS layers work fine for map display and query, but as soon as I try to highlight a feature using FILTERITEM and FILTER I get the following error (so it seems the filteritem is not used when building the WHERE clause, the column exists in the database and has the right case):
>
>[13-Sep-2005 13:06:43] PHP Warning:  [MapServer Error]: prepare_database(): Error executing POSTGIS DECLARE (the actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT identbv::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),OID::text from bouwvergunning.aanvraag WHERE (20050049) and (the_geom && setSRID( 'BOX3D(114024.650480941 503134.482620259,115117.267932596 503806.862590517)'::BOX3D,find_srid('','bouwvergunning.aanvraag','the_geom') ))' <br><br>
>
>Postgresql reports the error as 'ERROR:  argument of AND must be type boolean, not type integer ........
>
>This is my LAYER definition:
>
>LAYER
>  NAME "bimas"
>  METADATA
>    wms_title "Bouwvergunningen"
>  END
>  STATUS OFF
>  DEBUG ON
>  FILTERITEM "identbv"
>  FILTER "20050049"
>  TYPE POINT
>  CONNECTION "user=stragisweb password=synstragisweb dbname=wormerland host=127.0.0.1"
>  CONNECTIONTYPE postgis
>  DATA "the_geom from bouwvergunning.aanvraag USING UNIQUE identbv"
>  PROJECTION
>    "init=epsg:28992"
>  END
>  MINSCALE 0
>  MAXSCALE 10000
>  CLASS
>    NAME bouwlocaties
>    STYLE
>      COLOR 255 0 0
>      SIZE 12
>      SYMBOL "Bouwlocaties"
>    END
>  END
>  TEMPLATE "blank.html"
>END
>
>Thanks in advance. Is this fixed in CVS?
>
>Best regards,
>Bart
>
>Bart van den Eijnden
>Syncera IT Solutions
>Postbus 270
>2600 AG  DELFT
>
>tel.nr.: 015-7512436
>email: BEN at Syncera-ITSolutions.nl
>
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050620/1fd54211/attachment.html


More information about the mapserver-users mailing list