artemp/mapnik — Issue #369: Filter Condition String Whitespace is Stripped
Author: artemp
Created: 2011-10-11 16:14:52+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.