[postgis-users] ST_PointN(multilinestring) behavior in 2.0

Nicolas Gillet nicolas.gillet at market-ip.com
Mon Feb 18 23:52:10 PST 2013


Hello list,

While executing old scripts today I noticed that the behavior of the function ST_PointN has changed between postgis 1.5 and 2.0

When the function is used on a MULTILINESTRING the behavior is not the same and it looks like a bug in 2.0 I think.

The doc says :
""ST_PointN - Return the Nth point in the first linestring or circular linestring in the geometry. Return NULL if there is no linestring in the geometry.""
(http://postgis.refractions.net/documentation/manual-2.0/ST_PointN.html)

So when I call the function on a MULTILINESTRING I expect it to return the Nth point of the first linestring.
In postgis 1.5 it's the case but in 2.0 it returns null.

Example :
select st_astext(st_pointn(st_geomFromText('MULTILINESTRING((0 0, 1 1, 2 2))'), 2));
Result in postgis 1.5 (PostgreSQL 9.1)
"POINT(1 1)"
Result in postgis 2.0 (postgreSQL 9.2)
Null

I could fix my script by merging my multi into single geometries but I think that either the doc or the behavior of the function should be updated.

Regards,

Nicolas.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130219/4a0b90f1/attachment.html>


More information about the postgis-users mailing list