[postgis-users] Order of linestrings when using st_linemerge
Darafei "Komяpa" Praliaskouski
me at komzpa.net
Mon Feb 12 00:59:40 PST 2018
Hi,
ST_LineMerge is 2D, you will also have temporal issues when trying to merge
loops.
We've been storing timestamp in Z, but needed ST_Linemerge analog for that.
Here's what we use now:
https://github.com/gojuno/lostgis/blob/master/sql/functions/ST_TimeLineMerge.sql
You can also check if ST_MakeLine suits your needs - in aggregate form it
can consume linestring segments and just stitch them in order, generating
lacking segments as straight lines.
пн, 12 февр. 2018 г. в 11:52, Ben Madin <ben at ausvet.com.au>:
> G'day all,
>
> I have an example where I have a large number of multilinestrings
> representing the seaway track from one port to another. In order to
> interpolate the position of a vessel (this is historical data) along these
> tracks, we used a combination of st_linemerge and st_interpolate.
>
> The multilinestring respects the direction of travel (from the origin to
> the destination), so we thought this approach would work.
>
> However, to use st_interpolate, we need linestrings, so we used linemerge
> (looks perfect) but the line now goes from the destination to the origin.
> (of course, this is not predictable - sometimes it is in the right order).
>
> Is there any way to 'force' the linestring to have the same ordering as
> the multi-line string? we are using linestringm, can we take advantage of
> the M value?
>
> example:
>
> SELECT
> st_asewkt(st_linemerge(st_geomfromewkt('SRID=4326;MULTILINESTRINGM((115.723248216579
> -32.0454874969596 1,115.356718360803 -31.2649393614626
> 1.47593019400197,114.996206563468 -30.4833681123784
> 1.94793716099846,114.641442213985 -29.70082100447
> 2.41616662431401,114.292166370259 -28.9173431382814
> 2.88076010193012,113.948131063039 -28.1329775961666
> 3.34185510703625,113.609098642971 -27.347765569158
> 3.79958533994624,113.274841167352 -26.5617464753925
> 4.25408087178885,112.945139823841 -25.7749580707562
> 4.70546832037234),(112.945139823841 -25.7749580707562
> 4.70546832037234,112.569944851044 -24.955984154436
> 5.17822970085566,112.199711533849 -24.1360828251298
> 5.64785480680645,111.834198632833 -23.3153001472376
> 6.11447655756696,111.473173947045 -22.493680351942
> 6.57822465026799,111.116413762924 -21.6712659546459
> 7.03922572419879,110.763702333863 -20.8480978652059
> 7.49760351897373,110.414831388289 -20.0242154915183
> 7.95347902680775,110.069599664243 -19.1996568369764
> 8.40697063920594,109.727812468601 -18.3744585922724
> 8.85819428836509,109.389281259168 -17.5486562219864
> 9.30726358357774,109.053823248005 -16.7222840463694
> 9.75428994291997,108.721261024435 -15.8953753186967
> 10.1993827204972,108.391422196296 -15.0679622985443
> 10.6426493295126,108.06413904806 -14.2400763213105
> 11.0841953614157,107.73924821455 -13.411747864288
> 11.524124701379,107.416590369051 -12.5830066095668
> 11.9625396403441,107.096009924666 -11.7538815040321
> 12.3995409838705,106.777354747869 -10.9244008167035
> 12.8352281580124,106.46047588321 -10.0945921936453
> 13.2696993124424,106.145227288244 -9.2644827106659
> 13.7030514210349,105.831465577744 -8.43409892401077
> 14.1353803801144,105.519049776353 -7.60346691924052
> 14.5667811045696,105.207841078825 -6.77261235847855
> 14.997347622028),(105.990650130672 -5.91167003050344
> 14.997347622028,105.599572459125 -6.34228797455069
> 15.2785767014246,105.207841078825 -6.77261235847855
> 15.5600407259128),(106.663050248418 -5.99905605734687
> 15.5600407259128,105.990650130672 -5.91167003050344
> 15.8868531270388),(106.881437549142 -6.08393762734487
> 15.8868531270388,106.709016406789 -6.01184678072196
> 15.9769961743295),(106.709016406789 -6.01184678072196
> 15.9769961743295,106.663050248418 -5.99905605734687 16))')));
>
>
> cheers
>
> Ben
>
>
>
>
> --
>
> Ben Madin
> BVMS PhD
>
>
>
> m : +61 448 887 220 <+61%20448%20887%20220>
>
> e : ben at ausvet.com.au
>
> 5 Shuffrey Street, Fremantle
> Western Australia
>
> on the web: www.ausvet.com.au
>
>
> This transmission is for the intended addressee only and is confidential
> information. If you have received this transmission in error, please delete
> it and notify the sender. The contents of this email are the opinion of the
> writer only and are not endorsed by Ausvet unless expressly stated
> otherwise. Although Ausvet uses virus scanning software we do not accept
> liability for viruses or similar in any attachments.
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20180212/89866b96/attachment.html>
More information about the postgis-users
mailing list