Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

10.
Database house-keeping
● Each table should have a primary key
● Each spatial table should be recorded in
the geometry_columns table
● Each spatial table should have a spatial
index
CREATE INDEX yourtable_idx ON
yourtable USING
GIST(geometry_column);

11.
Querying data
● SQL: Structured Query Language
SELECT some comma de-limited
columns FROM your_table WHERE
some condition is met;
● Use PSQL from command line, PgAdmin3,
or PostgreSQL Manager/SQL Editor
● SQL is case-sensitive for table and column
names, and keywords are usually in
capitals

13.
Spatial Querying
● Find out which county a point is in:
SELECT “PROV3NAME” FROM
united_kingdom_counties WHERE
st_within(geomfromtext('point(-1.4
52.6)', 4326), the_geom);
● Find out the spatial extent of your data:
SELECT st_extent(the_geom) FROM
united_kingdom_counties;

20.
Displaying single layers
● Set the Layer status to “ON” rather than
“DEFAULT”
● Specify the layers as part of the URL:
http://localhost/cgi-
bin/mapserv?
map=/home/user/leics2010/demo.
map&layer=counties