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.
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 ...