The steps you need to perform to complete this recipe are as follows:
- First, perform a self-spatial join between your MultiLineString dataset and the PostGIS ST_Intersects function and find intersections in the join context with the ST_Intersection PostGIS function. The following is the basic query, resulting in 1,448 records being selected:
postgis_cookbook=# SELECT r1.gid AS gid1, r2.gid AS gid2, ST_AsText(ST_Intersection(r1.the_geom, r2.the_geom)) AS the_geom FROM chp03.rivers r1 JOIN chp03.rivers r2 ON ST_Intersects(r1.the_geom, r2.the_geom) WHERE r1.gid != r2.gid;
- You may hastily assume that all of the intersections are single points, but this is not the case; if you check the geometry type of the geometric intersections ...