[postgis-users] Postgis functions returning hidden weird characters! (?)

Vyron Antoniou v.antoniou at ucl.ac.uk
Sat Mar 6 12:02:05 PST 2010


Hi,

This is a weird one!

If you run the following sql:

select ST_AsSVG(ST_Difference(
ST_LineFromText('LINESTRING(528085.304556059
182402.75252444,528057.189235888 182383.627714979,528078.925527415
182348.523254458,528110.016845328 182367.72322892,528119.206862483
182351.764509452,528065.429111811 182316.692226383,528019.682277422
182382.682354742,528076.562322635 182418.577931056,528085.304556059
182402.75252444)'),
ST_Difference(ST_LineFromText('LINESTRING(528085.304556059
182402.75252444,528057.189235888 182383.627714979,528078.925527415
182348.523254458,528110.016845328 182367.72322892,528119.206862483
182351.764509452,528065.429111811 182316.692226383,528019.682277422
182382.682354742,528076.562322635 182418.577931056,528085.304556059
182402.75252444)'), ST_LineFromText('LINESTRING(528609 182468,528009
182468)'))
),0,5)

It sees like that you are getting nothing as a response (which is
geometrically correct!)

If you run this sql:
select ST_AsSVG(ST_Difference(
ST_LineFromText('LINESTRING(528930.958778316 181668,528945.758383221
181621.10086763,528907.323783 181609.420947433,528915.910261821
181576.356315477,528917.004045659 181556.777339062,528910.734095004
181545.323813335,528902.462041152 181542.732665401,528889.242540907
181547.159913121,528878.071632731 181564.70288216,528866.478880465
181598.881969597,528848.921015863 181656.67822709,528885.788489116
181668,528930.958778316 181668)'),
ST_Difference(ST_LineFromText('LINESTRING(528930.958778316
181668,528945.758383221 181621.10086763,528907.323783
181609.420947433,528915.910261821 181576.356315477,528917.004045659
181556.777339062,528910.734095004 181545.323813335,528902.462041152
181542.732665401,528889.242540907 181547.159913121,528878.071632731
181564.70288216,528866.478880465 181598.881969597,528848.921015863
181656.67822709,528885.788489116 181668,528930.958778316 181668)'),
ST_LineFromText('LINESTRING(529209 181668,528609 181668)'))
),0,5)

You get: "M 528885.78849 -181668 L 528930.95878 -181668" which is also
geometrically correct.

The problem is that if you try to parse the responses at the server (say
with PHP) in order to determine if you have any data returned or not, you
would be surprised to realize that the first response is not a completely
empty response (!) but instead there is something hidden there which looks
like: hˆ§□□, while with the second one you get exactly what
you see.

Someone could argue that this problem is caused by other factors not
related to postgis but the thing is that this combination of postgis
queries and PHP parsing didn’t used to cause any problems in previous
versions.

I’m running PostgreSQL 8.4 with Postgis 1.5 for 8.4 on Windows XP

Any suggestions?

Thanks
Byron









More information about the postgis-users mailing list