[postgis-users] Spatial Analysis? (PostGIS -> Well-Known Text-> JTS)

Paul Ramsey pramsey at refractions.net
Tue May 21 09:13:16 PDT 2002


The simplest patch to pgsql2shp would be an option to add a "where"
clause to the dumping SQL. So the dump would then be 'select * from
<table> where <where>'. That is a very simple patch. The trouble is that
the next request will be completely adhoc querying (ie, '<select>')
which requires a fairly substantial re-jig of the dumper code (the
dumper currently uses postgresql system tables to figure out things like
which column is the geometry, etc, and that information does not
transfer to adhoc queries).

"Obe, Regina DND\\MIS" wrote:
> 
> I'm not sure if there has been a recent version of pgsql2shp that can take
> ad hoc queries.  I remember there was some discussion of it, but haven't
> attempted that.
> 
> Normally what I do is use the option 2 you proposed  - whereby I create a
> view and then use pgsql2shp to dump it out as a shapefile.  That works
> pretty well.
> 
> -----Original Message-----
> From: C F [mailto:gis_consultant at hotmail.com]
> Sent: Tuesday, May 21, 2002 12:01 PM
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] Spatial Analysis? (PostGIS -> Well-Known Text
> -> JTS)
> 
> Hello,
> I'm just starting to look into PostGIS (don't even have it installed yet)
> and had a few questions about it if somebody wouldn't mind taking a stab at.
> 
>   First I'll tell you the requirement I'm after, then give you my ideas.
> What I would want is to be able to "cookie cut" (intersect) points, lines,
> and polygons from PostGIS layers using a polygon shape and put the results
> into a shapefile.  For now, I *might* be satisfied with only being able to
> do a bounding rectangle intersection since I see that sort of spatial
> operation is currently available in PostGIS.
> 
> 1)  It looks like the pgsql2shp utility only takes the entire layer, you
> cannot tell it to extract certain extents. Correct?
> 
> 2)  I assume that you can create views of your spatial data in
> PostGIS/PostgreSQL.... if so, would a workaround for #1 be to create a view
> using one of the spatial operators (something like ~=) and then use
> pgsql2shp on that view (if it works on views)?
> 
> 3)  If #1 and #2 are not good how about doing a query and putting it out to
> well-known text and then using some other product to convert that to a
> shapefile?  The problem is, I'm not seeing much available in that
> department.  It looks like OGR could do it... has anyone done this?
> 
> 4)  Now... if I really wanted to intersect layers with a non-rectangular
> polygon, what about using JTS?  PostGIS can output features in well-known
> text and JTS can read in well-known text... and it has the ability to do
> spatial operations.  I'm sure you can see where I'm going with this...
> PostGIS -> Well-Known Text -> JTS -> Well-Known Text -> Shapefile
> Sounds extremely ugly and slow, but I'm curious if anyone has attempted it
> (I don't think JTS can do Well-Known Binary).
> 
> Any comments would be much appreciated!  Thanks.
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

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




More information about the postgis-users mailing list