Getting ready

Unzip the data/TM_WORLD_BORDERS-0.3.zip file into your working directory, working/chp3. Import the shapefile in PostGIS with the shp2pgsql command, as follows:

$ shp2pgsql -s 4326 -g the_geom -W LATIN1 -I TM_WORLD_BORDERS-0.3.shp chp03.countries > countries.sql
$ psql -U me -d postgis_cookbook -f countries.sql
The file is also included with the name of wborders since for some operating systems, it does not work with the characters of TM_WORLD_BORDERS-0.3.shp.

Get PostGIS Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.