[postgis-users] intersecting and exporting
Seb
spluque at gmail.com
Thu Nov 8 21:46:22 PST 2012
Hi,
I recently set up a PostGIS database (named gshhs) in PostgreSQL 9.1
with PostGIS 1.5.3, and imported coastline data GSHHS 2.2.0 (from
ftp://ftp.soest.hawaii.edu/pwessel/gshhs/GSHHS_shp_2.2.0.zip) using:
shp2pgsql -s 4326 -I -g geom GSHHS_c_L1.shp gshhs_c_l1 | psql -d gshhs
I tried to define a new geometry as the intersection of this table and a
polygon like this:
CREATE TABLE regions (
id serial PRIMARY KEY,
name character varying);
SELECT AddGeometryColumn('', 'regions', 'geom', 4326, 'POLYGON', 2);
INSERT INTO regions (name, geom)
VALUES ('subset 1',
GeomFromText('POLYGON((-75 54, -57 54, -57 65, -75 65, -75 54))', 4326));
CREATE OR REPLACE VIEW subset1 AS
SELECT gid,
ST_Intersection((SELECT geom FROM gshhs_c_l1 WHERE gid=4),
(SELECT geom FROM regions WHERE id=1))
FROM gshhs_c_l1;
I'd like to plot this in a GIS, but am not sure how to export this to
CSV with lon/lat columns or perhaps as Geotiff. Thanks in advance for
any tips.
--
Seb
More information about the postgis-users
mailing list