artemp/trac2github — Issue #370: Filter Condition String Whitespace is Stripped
Author: artemp
Created: 2011-10-09 20:30:30+00:00
State: open
Labels: Core_Library

== Problem ==

There is an indifference in the way that the strings in Filters and the strings from the datasource are handled.

With a filter object, whitespace is trimmed from the matching value:
{{{
>>> from mapnik import *
>>> filter = Filter("[name]='value '")
>>> print filter
([name]='value')
}}}

Whitespace is ''not'' trimmed from the data (the following examples were selected from a 'character' [''not'' 'character varying'] column in a Postgres DB):
{{{
"Height Control "
"Inland Water "
"Political Or Administrative"
}}}

This results in filters not matching data it should.

== Solution ==

There are two possible obvious solutions. Either the filter condition ''should not'' be trimmed or the data ''should'' be trimmed.

I propose trimming the ''data'' to conform with Quantum GIS which takes this approach and allow continued compatability with Quantumnik exports.