Database Reference
In-Depth Information
$ chmod 775 import_eq.sh
$ ./import_eq.sh
Importing earthquakes with magnitude 1 to
chp03.earthquakes PostGIS table...
Importing earthquakes with magnitude 2 to
chp03.earthquakes PostGIS table...
...
5. Tomaintainconsistencywiththebook'sconventions,renamethegeometric
column
wkb_geometry
(thedefaultgeometryoutputnamein
ogr2ogr
)to
the_geom
, as illustrated in the following command:
postgis_cookbook=# ALTER TABLE
chp03.earthquakes RENAME wkb_geometry TO
the_geom;
6. Download the
cities
shapefile for USA from the
nationalatlas.gov
iesx020_nt00007.tar.gz
(this archive is also included in the code bundle
providedwiththisbook),andimportitinPostGISbyexecutingthefollowing
code:
$ ogr2ogr -f PostgreSQL -s_srs EPSG:4269
-t_srs EPSG:4326 -lco
GEOMETRY_NAME=the_geom -nln chp03.cities
PG:"dbname='postgis_cookbook' user='me'
password='mypassword'" citiesx020.shp
7. Download the
states
shapefile for USA from the
nationalatlas.gov
statesp020_nt00032.tar.gz
(this archive is also included in the code bundle
providedwiththisbook)andimportitinPostGIS byexecutingthefollowing
code:
$ ogr2ogr -f PostgreSQL -s_srs EPSG:4269
-t_srs EPSG:4326 -lco
GEOMETRY_NAME=the_geom -nln chp03.states
-nlt MULTIPOLYGON