If you did not follow the recipes in Chapter 1, Moving Data in and out of PostGIS, be sure to import the hotspots (Global_24h.csv) in PostGIS. The following steps explain how to do it with ogr2ogr (you should import the dataset in their original SRID, 4326, to make spatial operations faster):
- Start a session in the postgis_cookbook database:
> psql -d postgis_cookbook -U me
- Create a new schema chp10 in the postgis_cookbook database:
postgis_cookbook=# CREATE SCHEMA chp10;
- We need to create the hotspots_dist table, that will serve as parent for the foreign tables:
postgis_cookbook =# CREATE TABLE chp10.hotspots_dist (id serial PRIMARY KEY, the_geom public.geometry(Point,4326));
- Exit the psql environment:
postgis_cookbook=# ...