[postgis-users] Issue with ST_Line_Interpolate_Point dropping m values

Craig McIlwee craig.mcilwee at openroadsconsulting.com
Tue Jul 12 12:04:09 PDT 2011


Well I think Ive found the issue.  The function handles LINESTRING and MULTILINESTRING just fine, but gives 0 M values for LINESTRINGM and MULTILINESTRINGM.
 
SELECT ST_AsEWKT(ST_Line_Interpolate_Point(the_line, 0.5))
                FROM (SELECT ST_GeomFromEWKT('LINESTRING(1 2 3, 4 5 6, 6 7 8)') as the_line) As foo;
"POINTM(3.5 4.5 0)"
 
Is this expected behavior?  For now I think I can work around it by pulling the EWKT over to my client, doing a string replace on MULTILINESTRINGM to MULTILINESTRING, then using ST_GeomFromEWKT in a subsequent query.  It will certainly complicate my code and introduce a bit of I/O overhead, but it seems to work.
 
Craig
 
From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Craig McIlwee
Sent: Tuesday, July 12, 2011 2:07 PM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Issue with ST_Line_Interpolate_Point dropping m values
 
Hello,
 
Im using PostGIS 1.5 and am having trouble with the ST_Line_Interpolate_Point function, the M value of the returned points are always 0.   An example query with output is:
 
select st_asewkt(st_line_interpolate_point(st_geometryn(the_geom, 1), 0.88364273)) from wgs_statecov_tway;
"SRID=4326;POINTM(-90.4466123484958 38.8893086051018 0)"
 
 
My geometries are MULTILINESTRINGM type, and examination with ST_AsEWKT shows proper M values as you see below.  I also use the M value for other LRS functions.
 
select st_asewkt(st_endpoint(the_geom)) from wgs_statecov_tway;
"SRID=4326;POINTM(-90.2232337557835 38.8615691007846 136.351980792317)"
 
 
The odd thing is that when I try the example query from the reference manual everything works fine.
 
SELECT ST_AsEWKT(ST_Line_Interpolate_Point(the_line, 0.5))
                FROM (SELECT ST_GeomFromEWKT('LINESTRING(1 2 3, 4 5 6, 6 7 8)') as the_line) As foo;
"POINT(3.5 4.5 5.5)"
 
 
Based on this, it seems like I must be doing something but because the query is so simple I have no idea what that could be.  Any ideas?
 
Thanks,
Craig
Open Roads Consulting, Inc.
757-546-3401
http://www.openroadsconsulting.com
 
This e-mail communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.  If you are not the intended recipient, you should immediately stop reading this message and delete it from all computers that it resides on. Any unauthorized reading, distribution, copying or other use of this communication (or its attachments) is strictly prohibited.  If you have received this communication in error, please notify us immediately.
 


This e-mail communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.
P - Think before you print.

This e-mail communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.
P - Think before you print.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110712/8eb81a7c/attachment.html>


More information about the postgis-users mailing list