Nicolas, your code is really magic in the way it closes those segments even though they are in random sequence! I am beginning to think that I am going to need a combination of all the solutions proposed above to cover all the various contour scenarios, including those with gaps, without gaps, open against one map edge or multiple edges, fully enclosed with all segments already in sequence or in random sequence and/or with inverse point order. Brent, your links and examples may well be another strategy, I have a lot to learn, but I will start by trying to adapt your script. All this is going to take me a bit of time to evaluate, but with your help so far I am way ahead of where I was a week ago. Thanks again, I will not fail to take up your offer of help if I get stuck!. George
-- View this message in context: http://postgis.17.n6.nabble.com/Closing-polylines-tp4971098p4991411.html Sent from the PostGIS - User mailing list archive at Nabble.com. _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users