Given the 2 BASES in PostGIS that concern how to join them together?

I have a table in PostGIS and PostgreSQL with a LINESTRING column. I am creating a query, the result of which is to join this table with itself, and I know that the geometry columns (call them geom ) of each of them are connected, i.e. The first line is LINESTRING from A--B--…---K , and the second line K--L--…--T , i.e. the last point of the first LINESTRING is the same as the first point of the second LINESTRING.

Is there any function / expression where "concatinate" / "join" / "merge" / "extend" these 2 LINESTRING to 1 LINESTRING that looks like A--B--…--K--L--…--T ?

+4
source share
2 answers

You can use ST_Union in the following query:

 SELECT ST_Union(the_geom) from mytable; 
+5
source

I would look:

http://postgis.refractions.net/docs/ST_Union.html

It will return the union of the two geometries, which should be one line.

+2
source

Source: https://habr.com/ru/post/1385614/


All Articles