Verify labelling preserves whitespace from Attribute Value

Description

Report from Simon Greener via email as a follow on to [https://jira.codehaus.org/browse/GEOT-4632" title="Detect and preserve whitespace in TextSymbolizer Literals" class="issue-link" data-issue-key="GEOT-4632"><del>GEOT-4632</del>:

The problem is that we cannot stack text dynamically out of the database with a SQL View (property_stacked_label) defined on the following SQL.

Select p.property_id,
p.label_angle,
p.point,
trim(trailing '\n' from
replace(replace(replace(replace(replace(replace(
UPPER('%LABELS%'),
'STREET_NUMBER', street_number ||'\n'),
'STREET_NAME', street_number ||' '||street_address||'\n'),
'LOT_PLAN', lot_plan_label||'\n'),
'LAST_SALE_DATE', contract_date ||'\n'),
'LAST_SALE_PRICE',transfer_price||'\n'),
'PROPERTY_ID', p.property_id::text||'\n')) as label
FROM (select regexp_split_to_table('%PIDS%',E',') as property_id) t
inner join general.parcel_label p
on (p.property_id = t.property_id::integer)

In other words, the \n in the above between each label is not recognised by GeoServer.

Update - Simon was able to reproduce this issue using PostgreSQL and 2.5-RC2:

No luck. It still won't wrap. The \n s in the string are displayed.

Could this be a database codepage type problem? Is there another wrap character I could try?

Update:

Ended up being a database problem - see http://stackoverflow.com/questions/935/string-literals-and-escape-characters-in-postgresql - http://stackoverflow.com/questions/935/string-literals-and-escape-characters-in-postgresql

Revised query:

Select p.property_id,
p.label_angle,
p.point,
trim(trailing E' \n ' from
replace(replace(replace(replace(replace(replace(
UPPER('%LABELS%'),
'STREET_NUMBER', p.street_number ||E' \n '),
'STREET_NAME', p.street_address||E' \n '),
'LOT_PLAN', p.lot_plan_label||E' \n '),
'LAST_SALE_DATE',p.contract_date ||E' \n '),
'LAST_SALE_PRICE',p.transfer_price||E' \n '),
'PROPERTY_ID', p.property_id::text ||E' \n ')) as label
FROM (select regexp_split_to_table('%PIDS%',E',') as property_id) t
join general.parcel_label p
on (p.property_id = t.property_id::integer)

Resulting image is attached.

Environment

None

Activity

Show:
codehaus
April 10, 2015, 3:35 PM

CodeHaus Comment From: jgarnett - Time: Tue, 4 Mar 2014 07:18:01 -0600
---------------------
I will hold this open while we wait for sample data, I expect this is a JDBC encoding issue.

Currently it is CANNOT REPRODUCE.

codehaus
April 10, 2015, 3:35 PM

CodeHaus Comment From: jgarnett - Time: Wed, 5 Mar 2014 01:23:07 -0600
---------------------
Update: Simon was running an older version of GeoServer.

Marking this as Cannot Reproduce, Simon can reopen after he has tested 2.5-RC2. Since the test case verifies the renderer is behaving, the next place to look is the datastore.

codehaus
April 10, 2015, 3:35 PM

CodeHaus Comment From: jgarnett - Time: Wed, 5 Mar 2014 01:50:05 -0600
---------------------
Simon was able to reproduce the issue with 2.5-RC2:

&nbsp;&nbsp;&nbsp;No luck. It still won&#39;t wrap. The \n s in the string are displayed.

&nbsp;&nbsp;&nbsp;Could this be a database codepage type problem? Is there another wrap character I could try?

So next up is for Simon to send a data dump or shapefile showing the problem.

codehaus
April 10, 2015, 3:35 PM

CodeHaus Comment From: jgarnett - Time: Wed, 5 Mar 2014 19:06:56 -0600
---------------------
Added a note to the GeoServer postgis docs

Andrea Aime
February 15, 2017, 11:34 AM

Mass transitioning all resolved issues that have not been updated in the last month to closed state

Fixed

Assignee

Unassigned

Reporter

codehaus

Triage

None

Components

Affects versions

Priority

Medium
Configure