[postgis-users] help with a query
Jonatan Malaver
jon.malaver at shrewsburyma.gov
Wed Sep 14 05:09:23 PDT 2016
the reason being is that I do a network analysis by running the following
function:
WITH RECURSIVE flow(gid, geom) AS (
SELECT e.gid, e.geom FROM electric_line e, transformers t WHERE
ST_Distance(t.geom,ST_StartPoint(e.geom)) <= 0.01 AND t.gid=$1
UNION ALL
SELECT n.gid, n.geom
FROM electric_line n, flow f
WHERE ST_Distance(ST_EndPoint(f.geom),ST_StartPoint(n.geom)) <= 0.01
)
The problem I have is that some of the lines direction are in reversed. I'm
trying to correct them with referenced to the first line. Otherwise, I will
end up changing hundreds of lines manually.
On Tue, Sep 13, 2016 at 11:12 AM James Keener <jim at jimkeener.com> wrote:
> Depends on what you mean by direction. If you want to grab the start and
> end points (st_startpoint and st_endpoint) and check their x and y (st_x
> and st_y) for some condition (both less at the end?) Then update the record
> with the value of st_reverse.
>
> I guess my other question is why it matters.
>
> Jim
>
> On September 13, 2016 8:31:07 AM EDT, Jonatan Malaver <
> jon.malaver at shrewsburyma.gov> 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
>>
>>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
--
Thanks,
Jonatan Malaver
Assistant Engineer of Electrical and Cable Operations
Shrewsbury Electric & Cable Operations
100 Maple Avenue
Shrewsbury, MA 01545
Office: (508) 841-8610
Fax: (508) 842-9267
jon.malaver at shrewsburyma.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160914/49d65696/attachment.html>
More information about the postgis-users
mailing list