[postgis-users] Points with in multiple Polygons

Paragon Corporation lr at pcorp.us
Tue May 6 15:48:14 PDT 2008


Chris,

Just simply take out the the_geom from your SELECT part of the statement and
it will still output fine.

Its not terribly useful to output geometry fields with psql unless you are
doing a db dump.  

If you wanted to output geometry fields, you may want to consider using
pgsql2shp which comes packaged with PostGIS and should be in your PostgreSQL
bin folder.  That will output a dbf and ESRI shape file which you can load
in pretty much any GIS viewer since it's a defacto GIS standard so to speak.

 So syntax would be

pgsql2shp -f torcit -h myserver -u apguser -P apgpassword mygisdb 
	"SELECT DISTINCT ON (ncities.name) ncities.name, ncities.the_geom
FROM ncities INNER JOIN torpoly  ON ST_Within(ncities.the_geom,
torpoly.the_geom) ORDER BY ncities.name"

Where torcit is the name of the .shp and .dbf files that will be generated.

Hope that helps,
Regina

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of chris
brisendine
Sent: Tuesday, May 06, 2008 3:19 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Points with in multiple Polygons

It Works!!! Thanks!! I might one day want to remove the "the_geom" is that
hard to do.

Thanks

On Tue, May 6, 2008 at 1:43 PM, Burgholzer,Robert
<rwburgholzer at deq.virginia.gov> wrote:
> You probably need the name of your database in the command line call  
> with the "-d" switch.
>
>
>  Robert W. Burgholzer
>  Surface Water Modeler
>  Office of Water Supply and Planning
>  Virginia Department of Environmental Quality  
> rwburgholzer at deq.virginia.gov
>  804-698-4405
>  Open Source Modeling Tools:
>  http://sourceforge.net/projects/npsource/
>
>  -----Original Message-----
>  From: postgis-users-bounces at postgis.refractions.net
>  [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of  
> chris brisendine
>
>
> Sent: Tuesday, May 06, 2008 1:25 PM
>  To: PostGIS Users Discussion
>  Subject: Re: [postgis-users] Points with in multiple Polygons
>
>  I get a  relation "nqaatt" does not exist. I changed the sql to show  
> storm cells in the tornadowarning, it works fine in the pgAdmin III  
> tool area here is the sql statement
>
>  SELECT DISTINCT ON (ncities.name)
>         ncities.name, ncities.the_geom  FROM ncities INNER JOIN 
> torpoly  ON ST_Within(ncities.the_geom,
>  torpoly.the_geom)
>  ORDER BY ncities.name
>
>  the command I am using is  psql -f run.psql
>
>
>
>
>
>  On Tue, May 6, 2008 at 12:12 PM, Burgholzer,Robert  
> <rwburgholzer at deq.virginia.gov> wrote:
>  > You want to run that command with the "-f" switch, the "-c" switch 
> is  >  for a single command, not a script file.
>  >
>  >  HTH
>  >
>  >  Robert W. Burgholzer
>  >  Surface Water Modeler
>  >  Office of Water Supply and Planning  >  Virginia Department of 
> Environmental Quality  >  rwburgholzer at deq.virginia.gov  >  
> 804-698-4405  >  Open Source Modeling Tools:
>  >  http://sourceforge.net/projects/npsource/
>  >
>  >
>  >  -----Original Message-----
>  >  From: postgis-users-bounces at postgis.refractions.net
>  >  [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf 
> Of  >  chris brisendine  >  >  > Sent: Tuesday, May 06, 2008 11:35 AM  
> >  To: PostGIS Users Discussion  >  Subject: Re: [postgis-users] 
> Points with in multiple Polygons  >  >  Great Idea on the tornado 
> intersect it does from time to time! It  >  worked great ! thanks, 
> maybe one day it can save a life, If i wanted  >  to run the query 
> from the command line would i use the  psql -c  >  run.psql to output 
> a list to a txt file? im getting a error with that  >  ERROR:  syntax 
> error at or near "run" at character 1  >  LINE 1: run.psql  >  Thanks 
> alot your time is very appreciated!
>  >
>  >
>  > _______________________________________________
>  >  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
>  >
>  _______________________________________________
>  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
>
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





More information about the postgis-users mailing list