Database Reference
In-Depth Information
3. Add a real field to store the temperature for each city using the following
command:
postgis_cookbook=# ALTER TABLE
chp08.cities ADD COLUMN temperature real;
4. If you are on Linux, ensure that you follow the initial instructions of this
chapterandcreateaPythonvirtualenvironmentinordertocreateaPython-
isolatedenvironment,tobeusedforallthePythonrecipesofthisbook,and
activate it:
$ source postgis-cb-env/bin/activate
5. Onceactivated,ifyoustillhaven'tdoneit,youcaninstallthePythonpsycop-
g2 and simplejson packages needed for this recipe:
(postgis-cb-env)$ pip install psycopg2
(postgis-cb-env)$ pip install simplejson
How to do it...
Carry out the following steps:
1. Create the following table to host weather station data:
postgis_cookbook=# CREATE TABLE
chp08.wstations
postgis_cookbook-# (
postgis_cookbook(# id bigint NOT
NULL,
postgis_cookbook(# the_geom
geometry(Point,4326),
postgis_cookbook(# name character
varying(48),
postgis_cookbook(# temperature real,
postgis_cookbook(# CONSTRAINT
wstations_pk PRIMARY KEY (id )
postgis_cookbook(# );
Search WWH ::




Custom Search