<div dir="ltr"><div><div><div><div>Indeed, my data presents some lines with less that 3 vertices, see the screenshot below :<br><br><img src="cid:ii_i9u2c8ex0_14d67b340008190f" height="398" width="566"><br><br><br></div><br></div>I will probably use python to make all my tests in order to generate polygons when possible. - since I'm not confortable enough with postgresql to handle that.<br><br></div>I guess it is possible to adapt the query (in first post) to test if at least 3 vertices are there.<br></div><div>Or maybe I could adapt the nn_search() function to be sure the closest vertice is connected to others.<br></div><br><div><div><br><div><div>​<br><br><br><br><div><br></div></div></div></div></div></div>