[postgis-users] Select statement possible with Pgsql2shp?

Lowther, David W dlowther at ou.edu
Mon Feb 3 07:30:59 PST 2003

I would also be very interested in pgsql2shp using an input sql statement to
define what goes into the shapefile. If it already does this I would love to
know how.


-----Original Message-----
From: John Deck [mailto:jdeck at socrates.Berkeley.EDU] 
Sent: Monday, February 03, 2003 9:32 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Select statement possible with Pgsql2shp?

I'm looking for advice on how to use pgsql2shp by passing in select
statements dynamically.  I've seen references to a "-s " option on this list
but it doesn't seem to be an option for the current version of pgsql2shp.

What I'm trying to do:

I am building an application with postgis/mapserver that dynamically creates
thematic maps based on us_county.  This app accepts county names and values
via an web-service XML request, then creates a map with the appropriate
shading by county and returns the URL to a PNG file. I have run into several
limitations on the mapserver end (generally having to do with mapfile
restrictions and what I see as a somewhat inefficient process for describing
map parameters) so I have turned to postgis in the hopes of being able to
export a shape file based on dynamic parameters and then simply use a nicely
formatted, exported shapefile from mapserver.

Currently, I am able to create a view or a new table on the fly and then use
pgsql2shp to export the contents of this into a shapefile and then view that
table with mapserver.  However, I would far prefer to (1) pass in SQL
expressions to pgsql2shp dynamically, or (2) create a temporary table and
then call pgsql2shp by executing a external shell command as I don't want to
give the app permission to write permanent tables.  #1 I haven't figured out
yet and #2 doesn't work since the pgsql2shp command can't see the temporary
table since it executes externally.

Any bright ideas?

John Deck
Berkeley Natural History Museums Informatics Coordinator
(510) 643-3191

postgis-users mailing list postgis-users at postgis.refractions.net

More information about the postgis-users mailing list