[postgis-users] Closing polylines

Nicolas Ribot nicolas.ribot at gmail.com
Mon May 14 01:37:57 PDT 2012


Hi,

Glad it helped.

Doing some more tests yesterday (based on true contour lines and not
hand-made :) ) I noticed 2 problems in the code I gave you:

1°) The distance computation performed to identifiy closest segment
should only use start/end points of each segment, and not the whole
segment. So, the "order by" clause in "partition by" should be:
st_distance(
     st_collect(st_startpoint(s1.geom), st_endpoint(s1.geom)),
     st_collect(st_startpoint(s2.geom),st_endpoint(s2.geom))
)

2°) If a contour line is opened but contains only one segment, it
won't be processed in my code.
These contours could be processed at the beginning, by force closing them.

Nicolas

On 13 May 2012 23:40, george wash <gws293 at hotmail.com> wrote:
> Thank you Mike and Nicolas for your prompt replies. I am astonished at the
> speed you were able to provide answers to a problem I have been working on
> and off and with limited results for a week! Mike, your function works
> beautifully on its own in many instances, but it's in conjunction with
> Nicolas other functions that it solves all my problems. I cannot be sure
> that all my contour lines will be closed, but I am confident now that the
> vast majority will be and that is good enough for my needs.
> Thanks again for your great help
> Bill
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list