[postgis] postgis and shpfile library

Obe, Regina DND\MIS Regina.Obe.PFD at ci.boston.ma.us
Fri Dec 14 12:46:51 PST 2001


I've been able to use pgsql2shp against Views too (treating views as if they
were tables) and seems to work pretty well.  The upside of using a view
would be that if you have a query you always run you don't have to dump the
query results every time into a static table - it will change as your base
tables change if you save the query as a view.  Also it's a quick way to
store the query and you can always DROP  it with DROP VIEW.

For Example instead of creating a table do something of the form

CREATE VIEW myview As
SELECT .... FROM ...


Then use the myview as if it were a table in the pgsql2shp call.

I was even able to create a view based on a UNION something of the form

CREATE VIEW myview AS
	SELECT t.Address, centroid(p.the_geom) as the_geom
		FROM table1 t INNER JOIN parcels p ON t.parcelid =
p.parcelid
	UNION
	SELECT t2.Address, centroid(the_geom) As the_geom
		FROM table2 t2 INNER JOIN parcels p ON t2.parcelid =
p.parcelid


Then used pgsql2shp to dump out the output with

pgsql2shp -h myserver mydb myview







-----Original Message-----
From: Paul Ramsey [mailto:pramsey at refractions.net]
Sent: Friday, December 14, 2001 12:34 PM
To: postgis at yahoogroups.com
Subject: Re: [postgis] postgis and shpfile library


Mapserver can also be used to write shape files as a result of a query,
with the mapscript extension, but it is notoriously finnicky to get that
functionality to work write, so I would not recommend it unless you are
very patient.

Dave Blasby wrote:
> 
> Jeff lounsbury wrote:
> >
> > Use the pgsql2shp program that comes in your postgis install.
> > -Jeff
> 
> If you're just trying to get the results of a query, you can create a
> table with the query results and then dump the table.
> 
> CREATE TABLE blah AS (SELECT ....);
> 
> Perhaps jeff (or someone else) could extend the pgsql2shp program to
> accept an sql query instead of a table name.
> 
> dave
> 
> 
> To unsubscribe from this group, send an email to:
> postgis-unsubscribe at yahoogroups.com
> 
> 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

-- 
      __
     /
     | Paul Ramsey
     | Refractions Research
     | Email: pramsey at refractions.net
     | Phone: (250) 885-0632
     \_


To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Win a Capcom Console Game.
http://us.click.yahoo.com/smpz8B/fxbDAA/ySSFAA/PhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 





More information about the postgis-users mailing list