[postgis-users] help with a query
Jonatan Malaver
jon.malaver at shrewsburyma.gov
Tue Sep 13 07:16:49 PDT 2016
This is the query I have so far:
WITH RECURSIVE flow(gid, geom) AS (
SELECT e.gid, e.geom FROM electric_line e WHERE e.gid = 3312
UNION ALL
SELECT n.gid, n.geom
FROM electric_line n, flow f
WHERE ST_DWithin(ST_EndPoint(f.geom),ST_StartPoint(n.geom),0.01)
)
UPDATE electric_line SET geom = ST_Reverse(electric_line.geom) FROM flow
WHERE electric_line.gid = flow.gid;
Is it possible to add an If statement that would only update if the
EndPoint is not StartPoint of the next the line?
On Tue, Sep 13, 2016 at 8:37 AM Leknín Řepánek <godzilalalala at gmail.com>
wrote:
> ST_EndPoint, ST_StartPoint, ST_Reverse.
>
> On Tue, Sep 13, 2016 at 12:31:07PM +0000, Jonatan Malaver wrote:
> > Hello,
> >
> > I'm trying to come up with a query that would check the direction of
> a line.
> > If the end point is not the start point of the next line to update the
> line by
> > reversing that line. Can anyone give me pointers on how to do it?
> >
> > Thanks,
> > Jon
>
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/postgis-users
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160913/dccef439/attachment.html>
More information about the postgis-users
mailing list