Computing intersections
One typical GIS geoprocessing workflow is to compute intersections generated by intersecting linear geometries.
PostGIS offers a rich set of functions for solving this particular type of problem and you will have a look at them in this recipe.
Getting ready
Download the rivers
dataset from the following naturalearthdata.com
website (or use the ZIP file included in the code bundle provided with this book):
Extract the shapefile to your working directory, chp03/working
. Import the shapefile in PostGIS using shp2pgsql
as follows:
$ shp2pgsql -I -W LATIN1 -s 4326 -g the_geom ne_10m_rivers_lake_centerlines.shp chp03.rivers > rivers.sql $ psql -U me -d postgis_cookbook -f rivers.sql
How to do it...
The steps you need to perform to complete this recipe are as follows:
First, perform a self-spatial join with your
MultiLineString
dataset with the PostGISST_Intersects...