[postgis-users] st_linemerge not working with 4d coords

Rémi Cura remi.cura at gmail.com
Sun May 11 11:39:29 PDT 2014


Hey,
if you want to do such basic sewing (same point for beginning/end),
it should be easyer to sew by hand.

If you do real line merge, (some shared part of lines are fusioned),
it is more difficult has you want your data to be interpolated (what should
happen if 2 shared segments have different data?).
Maybe you could try to trick the system by using line merge but putting an
index to a point table.

For instance your lines
LINESTRING(5 5 5 5, 10 10 10 10)'),ST_GeomFromEWKT('LINESTRING(10 10 10 10
, 15 15 15 15)'))));

would become
linestring(5 5 1, 10 10 2), linestring(10 10 3, 15 15 4). etc.
and the point table would be
1 5 5
2 10 10
3 10 10
4 15 15

The trick is that if 3D is leaved alone by ST_LineMerge, you can use the
index a-posteriori do do your computation on 4th coordinate (and retrieve Z
at the same time)

Hovewer if you really want to do it right you should use the topology to
get the shared parts and perform your custom data computation on it.

Cheers,
Rémi-C


2014-05-10 17:35 GMT+02:00 Paul Ramsey <pramsey at cleverelephant.ca>:

> LineMerge is implemented via the GEOS library which, unlike PostGIS,
> only understands 3 dimensions max. So the 4th is sacrificed in the
> process. There's no good / easy way to retain it. you could write a
> post-process routine that took every output vertex and compared it to
> the input geometry to try and figure out what the original M dimension
> was, I suppose.
>
> P.
>
> On Thu, May 8, 2014 at 8:38 AM, Paolo Importuni <imppao at gmail.com> wrote:
> > Hi everybody,
> >
> > I am trying to merge two linestring like in the following example:
> >
> > select st_astext(st_linemerge(st_collect(ST_GeomFromEWKT('LINESTRING(5 5
> 5
> > 5, 10 10 10 10)'),ST_GeomFromEWKT('LINESTRING(10 10 10 10 , 15 15 15
> > 15)'))));
> >
> >
> > but the output is
> > "LINESTRING Z (5 5 5,10 10 10,15 15 15)"
> >
> > that is,  the 4th dimension is lost.
> >
> > Can anyone please explain  me the reason  and how to overcome this
> problem?
> >
> > Thanks and best regards
> >
> > Paolo
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at lists.osgeo.org
> > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140511/3aec197f/attachment.html>


More information about the postgis-users mailing list