[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    AW: [postgis-users] psql2shp on two tables to get one shapefile..
From:       Düster_Horst <Horst.Duester () bd ! so ! ch>
Date:       2003-06-26 7:15:31
Message-ID: 5B025B1F39D6D4119F5700508BEEEC66F9476F () srsofaioi4546 ! ktso ! ch
[Download RAW message or body]

Nick,

you can use ogr2ogr delivered with the GDAL/OGR Library. With ogr2ogr is is
very easy to create output shapes joined from two or more tables due to the
-sql option.

Example:

ogr2ogr -f 'ESRI Shapefile' <shapefilename> PG:'dbname= user= host=' -sql
'<your SQL query to join the tables>' -nln <shapefilename>

Horst


-----Ursprüngliche Nachricht-----
Von: Nick Ton [mailto:nton@photon.com]
Gesendet am: Mittwoch, 25. Juni 2003 20:40
An: 'PostGIS Users Discussion'
Betreff: [postgis-users] psql2shp on two tables to get one shapefile...



Hi Everyone,

I am trying to create a shapefile where the data is based on two different
tables.
Has anyone done this before? Here is my problem, simplified:

-- City table contains some information, plus the_geom
CREATE TABLE city_tbl
(
   city_id	int,
   name text,
   area_cvrg real,
   the_geom geometry,
PRIMARY KEY (city_id)
);

-- City statistics table contains additional information 
-- that has to be linked to the city table in order to make the shapefile
complete
CREATE TABLE city_stats_tbl
(
   budget	numeric,
   population real,
   city_id REFERENCES city_tbl
);

One thought I had but wasn't sure if this is correct -- could I join the two
tables
together into a temp table, then perform a pgsql2shp on the temp table.
Please let
me your thoughts.

Thanks,
Nick




_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic