[postgis-users] intersecting and exporting

Francois Hugues hugues.francois at irstea.fr
Thu Nov 8 23:34:07 PST 2012


Hello,

To plot this in a gis you don't really need to export it you can add a query layer in most of the gis software :
- openjump : layer/sql query
- qgis : layer/new postgis layer
- arcgis : file/add data/add query layer

You can directly use your intersection query or select * from subset1

Hugues.


-------- Message d'origine--------
De: postgis-users-bounces at lists.osgeo.org de la part de Seb
Date: ven. 09/11/2012 06:46
À: postgis-users at postgis.refractions.net
Objet : [postgis-users] intersecting and exporting
 
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

_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3531 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121109/156fcebf/attachment.bin>


More information about the postgis-users mailing list