I create a new post to clarify more. My former answer was not adapted here : (Create polygon from lines in PostGIS I apologize for my english.

I have a problem to build polygons. enter image description here

And I run a query :

  WITH t AS (
      array_agg(l.geom)||st_exteriorring(p.geom) AS t
    FROM "CTRL_SONDE_XXXX"."067_TRIANGLE_non_intersect_Delau" p,
      "CTRL_SONDE_XXXX"."067_line_intertriangle_Delau_step1_sel" l
    WHERE ST_Intersects(
    GROUP BY p.id_triangle,p.geom
  u AS (
    SELECT id_triangle, st_dump(st_node(st_collect(t))) d
    FROM t
  SELECT (st_dump(st_polygonize((d).geom ORDER BY (d).path))).geom
  FROM u
  GROUP BY id_triangle;

but the result is wrong : enter image description here

Do you have any idea?

  • A few points, 1. Never use " or capitals for identifiers in psql. It's an anti-pattern. 2. Don't use SQL-89' JOIN-syntax. We can't troubleshoot this without test data. I'm not even sure where the non-existent lines come from in your output. My original guess is that they don't satisfy the definition ST_Intersects (meaning ST_Touches in this case). – Evan Carroll May 17 '17 at 21:24

Don't use snaptogrid because point can be snap on bad point. So there is no intersection. Probleme is in relation to tolerance XY. The tolerance need be set on geoprocessing. Look at this subject http://revenant.ca/www/postgis/workshop/advanced.html#processing-functions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.