Skip to main content
deleted 58 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Maybe it's not a very elegant solution and it's based on the method of answering question: https://gis.stackexchange.com/a/295348/120129.

It's one of the variants of solving your question, set up a geoinstrument (for me it's a road with the name "road_border" 11 m wide, type - line (MultiLineString)),

run a geoinstrument :-),

WITH 
      tbla AS (SELECT id, ((ST_DumpPoints(geom)).geom) geom FROM road_border),
      tblb AS (SELECT (ST_Buffer((ST_Dump(geom)).geom, 0.0001)) geom FROM tbla),
      tblc AS (SELECT ST_Centroid(ST_UnaryUnion(Unnest(ST_ClusterWithin(geom, 0.0001)))) geom FROM tblb),
      tbld AS (SELECT ((ST_Dump(ST_DelaunayTriangles(ST_Collect(geom)))).geom) geom FROM tblc),
      tble AS (SELECT (ST_Boundary(geom)) geom FROM ST_Dump((SELECT ST_Polygonize(geom) geom FROM (SELECT ST_Union(geom) geom FROM
      (SELECT ST_ExteriorRing(geom) geom FROM tbld) AS lines) AS foo))),
      tblf AS (SELECT ST_MakeLine(p1, p2) geom FROM (SELECT ST_PointN(geom, generate_series(1, ST_NPoints(geom)-1)) p1,
      ST_PointN(geom, generate_series(2, ST_NPoints(geom))) p2 FROM tble) AS geom),
      tblg AS (SELECT ST_Buffer((ST_Dump(ST_Union(ST_Buffer(geom, 0.0005)))).geom, -0.0005) geom FROM road_border)
      SELECT ST_Intersection (a.geom, b.geom) geom FROM tblf a JOIN tblg b ON ST_Within(a.geom, b.geom);

and see the result.

Good luck to everyone :-),

Original solutions ...

This script is called - ST_RoadAxisFromDelaunayTriangulation...

Maybe it's not a very elegant solution and it's based on the method of answering question: https://gis.stackexchange.com/a/295348/120129.

It's one of the variants of solving your question, set up a geoinstrument (for me it's a road with the name "road_border" 11 m wide, type - line (MultiLineString)),

run a geoinstrument :-),

WITH 
      tbla AS (SELECT id, ((ST_DumpPoints(geom)).geom) geom FROM road_border),
      tblb AS (SELECT (ST_Buffer((ST_Dump(geom)).geom, 0.0001)) geom FROM tbla),
      tblc AS (SELECT ST_Centroid(ST_UnaryUnion(Unnest(ST_ClusterWithin(geom, 0.0001)))) geom FROM tblb),
      tbld AS (SELECT ((ST_Dump(ST_DelaunayTriangles(ST_Collect(geom)))).geom) geom FROM tblc),
      tble AS (SELECT (ST_Boundary(geom)) geom FROM ST_Dump((SELECT ST_Polygonize(geom) geom FROM (SELECT ST_Union(geom) geom FROM
      (SELECT ST_ExteriorRing(geom) geom FROM tbld) AS lines) AS foo))),
      tblf AS (SELECT ST_MakeLine(p1, p2) geom FROM (SELECT ST_PointN(geom, generate_series(1, ST_NPoints(geom)-1)) p1,
      ST_PointN(geom, generate_series(2, ST_NPoints(geom))) p2 FROM tble) AS geom),
      tblg AS (SELECT ST_Buffer((ST_Dump(ST_Union(ST_Buffer(geom, 0.0005)))).geom, -0.0005) geom FROM road_border)
      SELECT ST_Intersection (a.geom, b.geom) geom FROM tblf a JOIN tblg b ON ST_Within(a.geom, b.geom);

and see the result.

Good luck to everyone :-),

Original solutions ...

This script is called - ST_RoadAxisFromDelaunayTriangulation...

Maybe it's not a very elegant solution and it's based on the method of answering question: https://gis.stackexchange.com/a/295348/120129.

It's one of the variants of solving your question, set up a geoinstrument (for me it's a road with the name "road_border" 11 m wide, type - line (MultiLineString)),

run a geoinstrument :-),

WITH 
      tbla AS (SELECT id, ((ST_DumpPoints(geom)).geom) geom FROM road_border),
      tblb AS (SELECT (ST_Buffer((ST_Dump(geom)).geom, 0.0001)) geom FROM tbla),
      tblc AS (SELECT ST_Centroid(ST_UnaryUnion(Unnest(ST_ClusterWithin(geom, 0.0001)))) geom FROM tblb),
      tbld AS (SELECT ((ST_Dump(ST_DelaunayTriangles(ST_Collect(geom)))).geom) geom FROM tblc),
      tble AS (SELECT (ST_Boundary(geom)) geom FROM ST_Dump((SELECT ST_Polygonize(geom) geom FROM (SELECT ST_Union(geom) geom FROM
      (SELECT ST_ExteriorRing(geom) geom FROM tbld) AS lines) AS foo))),
      tblf AS (SELECT ST_MakeLine(p1, p2) geom FROM (SELECT ST_PointN(geom, generate_series(1, ST_NPoints(geom)-1)) p1,
      ST_PointN(geom, generate_series(2, ST_NPoints(geom))) p2 FROM tble) AS geom),
      tblg AS (SELECT ST_Buffer((ST_Dump(ST_Union(ST_Buffer(geom, 0.0005)))).geom, -0.0005) geom FROM road_border)
      SELECT ST_Intersection (a.geom, b.geom) geom FROM tblf a JOIN tblg b ON ST_Within(a.geom, b.geom);

and see the result.

This script is called - ST_RoadAxisFromDelaunayTriangulation.

deleted 1 character in body
Source Link

Maybe it's not a very elegant solution and it's based on the method of answering question: https://gis.stackexchange.com/a/295348/120129.

It's one of the variants of solving your question, set up a geoinstrument (for me it's a road with the name "road_border" 11 m wide, type - line (MultiLineString)),

run a geoinstrument :-),

WITH 
      tbla AS (SELECT id, ((ST_DumpPoints(geom)).geom) geom FROM road_border),
      tblb AS (SELECT (ST_Buffer((ST_Dump(geom)).geom, 0.0001)) geom FROM tbla),
      tblc AS (SELECT ST_Centroid(ST_UnaryUnion(Unnest(ST_ClusterWithin(geom, 0.0001)))) geom FROM tblb),
      tbld AS (SELECT ((ST_Dump(ST_DelaunayTriangles(ST_Collect(geom)))).geom) geom FROM tblc),
      tble AS (SELECT (ST_Boundary(geom)) geom FROM ST_Dump((SELECT ST_Polygonize(geom) geom FROM (SELECT ST_Union(geom) geom FROM
      (SELECT ST_ExteriorRing(geom) geom FROM tbld) AS lines) AS foo))),
      tblf AS (SELECT ST_MakeLine(p1, p2) geom FROM (SELECT ST_PointN(geom, generate_series(1, ST_NPoints(geom)-1)) p1,
      ST_PointN(geom, generate_series(2, ST_NPoints(geom))) p2 FROM tble) AS geom),
      tbljtblg AS (SELECT ST_Buffer((ST_Dump(ST_Union(ST_Buffer(geom, 0.0005)))).geom, -0.0005) geom FROM road_border)
      SELECT ST_Intersection (a.geom, b.geom) geom FROM tblf a JOIN tbljtblg b ON ST_Within (a.geom, b.geom);

and see the result.

Good luck to everyone :-),

Original solutions ...

This script is called - ST_RoadAxisFromDelaunayTriangulation...

Maybe it's not a very elegant solution and it's based on the method of answering question: https://gis.stackexchange.com/a/295348/120129.

It's one of the variants of solving your question, set up a geoinstrument (for me it's a road with the name "road_border" 11 m wide, type - line (MultiLineString)),

run a geoinstrument :-),

WITH 
      tbla AS (SELECT id, ((ST_DumpPoints(geom)).geom) geom FROM road_border),
      tblb AS (SELECT (ST_Buffer((ST_Dump(geom)).geom, 0.0001)) geom FROM tbla),
      tblc AS (SELECT ST_Centroid(ST_UnaryUnion(Unnest(ST_ClusterWithin(geom, 0.0001)))) geom FROM tblb),
      tbld AS (SELECT ((ST_Dump(ST_DelaunayTriangles(ST_Collect(geom)))).geom) geom FROM tblc),
      tble AS (SELECT (ST_Boundary(geom)) geom FROM ST_Dump((SELECT ST_Polygonize(geom) geom FROM (SELECT ST_Union(geom) geom FROM
      (SELECT ST_ExteriorRing(geom) geom FROM tbld) AS lines) AS foo))),
      tblf AS (SELECT ST_MakeLine(p1, p2) geom FROM (SELECT ST_PointN(geom, generate_series(1, ST_NPoints(geom)-1)) p1,
      ST_PointN(geom, generate_series(2, ST_NPoints(geom))) p2 FROM tble) AS geom),
      tblj AS (SELECT ST_Buffer((ST_Dump(ST_Union(ST_Buffer(geom, 0.0005)))).geom, -0.0005) geom FROM road_border)
      SELECT ST_Intersection (a.geom, b.geom) geom FROM tblf a JOIN tblj b ON ST_Within (a.geom, b.geom);

and see the result.

Good luck to everyone :-),

Original solutions ...

This script is called - ST_RoadAxisFromDelaunayTriangulation...

Maybe it's not a very elegant solution and it's based on the method of answering question: https://gis.stackexchange.com/a/295348/120129.

It's one of the variants of solving your question, set up a geoinstrument (for me it's a road with the name "road_border" 11 m wide, type - line (MultiLineString)),

run a geoinstrument :-),

WITH 
      tbla AS (SELECT id, ((ST_DumpPoints(geom)).geom) geom FROM road_border),
      tblb AS (SELECT (ST_Buffer((ST_Dump(geom)).geom, 0.0001)) geom FROM tbla),
      tblc AS (SELECT ST_Centroid(ST_UnaryUnion(Unnest(ST_ClusterWithin(geom, 0.0001)))) geom FROM tblb),
      tbld AS (SELECT ((ST_Dump(ST_DelaunayTriangles(ST_Collect(geom)))).geom) geom FROM tblc),
      tble AS (SELECT (ST_Boundary(geom)) geom FROM ST_Dump((SELECT ST_Polygonize(geom) geom FROM (SELECT ST_Union(geom) geom FROM
      (SELECT ST_ExteriorRing(geom) geom FROM tbld) AS lines) AS foo))),
      tblf AS (SELECT ST_MakeLine(p1, p2) geom FROM (SELECT ST_PointN(geom, generate_series(1, ST_NPoints(geom)-1)) p1,
      ST_PointN(geom, generate_series(2, ST_NPoints(geom))) p2 FROM tble) AS geom),
      tblg AS (SELECT ST_Buffer((ST_Dump(ST_Union(ST_Buffer(geom, 0.0005)))).geom, -0.0005) geom FROM road_border)
      SELECT ST_Intersection (a.geom, b.geom) geom FROM tblf a JOIN tblg b ON ST_Within(a.geom, b.geom);

and see the result.

Good luck to everyone :-),

Original solutions ...

This script is called - ST_RoadAxisFromDelaunayTriangulation...

deleted 8 characters in body
Source Link

WITH ta AS (SELECT id, ((ST_DumpPoints(geom)).geom) as geom FROM road_border), tb as (SELECT (ST_Buffer((ST_Dump(geom)).geom, 0.0001)) geom FROM ta), tc as (SELECT ST_Centroid(ST_UnaryUnion(Unnest(ST_ClusterWithin(geom, 0.0001)))) geom FROM tb), td as (SELECT ((ST_Dump(ST_DelaunayTriangles(ST_Collect(geom)))).geom) geom FROM tc), te as (SELECT (ST_Boundary(geom)) geom FROM ST_Dump((SELECT ST_Polygonize(geom) AS geom FROM (SELECT ST_Union(geom) AS geom FROM (SELECT ST_ExteriorRing(geom) AS geom FROM td) AS lines) as foo))), tf as (SELECT ST_MakeLine(p1,p2) geom FROM (SELECT ST_PointN(geom, generate_series(1, ST_NPoints(geom)-1)) p1, ST_PointN(geom, generate_series(2, ST_NPoints(geom))) p2 FROM te) AS geom), tj as (SELECT ST_Buffer((ST_Dump(ST_Union(ST_Buffer(geom, 0.0005)))).geom, -0.0005) geom FROM road_border) SELECT ST_Intersection (a.geom, b.geom) AS geom FROM tf as a JOIN tj as b ON ST_Within (a.geom, b.geom);

WITH 
      tbla AS (SELECT id, ((ST_DumpPoints(geom)).geom) geom FROM road_border),
      tblb AS (SELECT (ST_Buffer((ST_Dump(geom)).geom, 0.0001)) geom FROM tbla),
      tblc AS (SELECT ST_Centroid(ST_UnaryUnion(Unnest(ST_ClusterWithin(geom, 0.0001)))) geom FROM tblb),
      tbld AS (SELECT ((ST_Dump(ST_DelaunayTriangles(ST_Collect(geom)))).geom) geom FROM tblc),
      tble AS (SELECT (ST_Boundary(geom)) geom FROM ST_Dump((SELECT ST_Polygonize(geom) geom FROM (SELECT ST_Union(geom) geom FROM
      (SELECT ST_ExteriorRing(geom) geom FROM tbld) AS lines) AS foo))),
      tblf AS (SELECT ST_MakeLine(p1, p2) geom FROM (SELECT ST_PointN(geom, generate_series(1, ST_NPoints(geom)-1)) p1,
      ST_PointN(geom, generate_series(2, ST_NPoints(geom))) p2 FROM tble) AS geom),
      tblj AS (SELECT ST_Buffer((ST_Dump(ST_Union(ST_Buffer(geom, 0.0005)))).geom, -0.0005) geom FROM road_border)
      SELECT ST_Intersection (a.geom, b.geom) geom FROM tblf a JOIN tblj b ON ST_Within (a.geom, b.geom);

WITH ta AS (SELECT id, ((ST_DumpPoints(geom)).geom) as geom FROM road_border), tb as (SELECT (ST_Buffer((ST_Dump(geom)).geom, 0.0001)) geom FROM ta), tc as (SELECT ST_Centroid(ST_UnaryUnion(Unnest(ST_ClusterWithin(geom, 0.0001)))) geom FROM tb), td as (SELECT ((ST_Dump(ST_DelaunayTriangles(ST_Collect(geom)))).geom) geom FROM tc), te as (SELECT (ST_Boundary(geom)) geom FROM ST_Dump((SELECT ST_Polygonize(geom) AS geom FROM (SELECT ST_Union(geom) AS geom FROM (SELECT ST_ExteriorRing(geom) AS geom FROM td) AS lines) as foo))), tf as (SELECT ST_MakeLine(p1,p2) geom FROM (SELECT ST_PointN(geom, generate_series(1, ST_NPoints(geom)-1)) p1, ST_PointN(geom, generate_series(2, ST_NPoints(geom))) p2 FROM te) AS geom), tj as (SELECT ST_Buffer((ST_Dump(ST_Union(ST_Buffer(geom, 0.0005)))).geom, -0.0005) geom FROM road_border) SELECT ST_Intersection (a.geom, b.geom) AS geom FROM tf as a JOIN tj as b ON ST_Within (a.geom, b.geom);

WITH 
      tbla AS (SELECT id, ((ST_DumpPoints(geom)).geom) geom FROM road_border),
      tblb AS (SELECT (ST_Buffer((ST_Dump(geom)).geom, 0.0001)) geom FROM tbla),
      tblc AS (SELECT ST_Centroid(ST_UnaryUnion(Unnest(ST_ClusterWithin(geom, 0.0001)))) geom FROM tblb),
      tbld AS (SELECT ((ST_Dump(ST_DelaunayTriangles(ST_Collect(geom)))).geom) geom FROM tblc),
      tble AS (SELECT (ST_Boundary(geom)) geom FROM ST_Dump((SELECT ST_Polygonize(geom) geom FROM (SELECT ST_Union(geom) geom FROM
      (SELECT ST_ExteriorRing(geom) geom FROM tbld) AS lines) AS foo))),
      tblf AS (SELECT ST_MakeLine(p1, p2) geom FROM (SELECT ST_PointN(geom, generate_series(1, ST_NPoints(geom)-1)) p1,
      ST_PointN(geom, generate_series(2, ST_NPoints(geom))) p2 FROM tble) AS geom),
      tblj AS (SELECT ST_Buffer((ST_Dump(ST_Union(ST_Buffer(geom, 0.0005)))).geom, -0.0005) geom FROM road_border)
      SELECT ST_Intersection (a.geom, b.geom) geom FROM tblf a JOIN tblj b ON ST_Within (a.geom, b.geom);
added 47 characters in body
Source Link
Loading
added 141 characters in body
Source Link
Loading
Source Link
Loading