[postgis-users] ogr2ogr creating shapefile

Bruce Rindahl rindahl at lrcwe.com
Tue Sep 12 13:09:46 PDT 2006


An ESRI shapefile can only have one type of geometry.  You can't have a
point and a polygon in one shapefile.
Bruce Rindahl

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Frances
Collier
Sent: Tuesday, September 12, 2006 2:07 PM
To: 'PostGIS Users Discussion'
Subject: RE: [postgis-users] ogr2ogr creating shapefile


Thank you Bill. That worked wonderfully. 

Now, I have another problem. When I try to open the shape file, it breaks.
The ESRI software says that the number of shapes does not match the number
of table records. When I open the .dbf there are no records. The getPop()
function is returning a point column and a polygon column. Does it need more
than?

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Bill
Thoen
Sent: Tuesday, September 12, 2006 12:50 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] ogr2ogr creating shapefile

Oddly enough, 'Select' must be lower case for this to work. 

On Tue, Sep 12, 2006 at 12:32:46PM -0700, Frances Collier wrote:
> Thank you for your reply, David. I did copy and post the question to the
> gdal-dev mailing list. In the meantime, though, I tried using pgsql2shp.
My
> exact syntax:
> 
> Pgsql2shp -f D:\myshapefile.shp -u postgres -P postgres mydb 'Select *
from
> getPop()'
> 
> The print out is: Initializing... Querying for attributes: ERROR: syntax
> error at or near "Select" at character 152  Now, I've tried putting both
> single and double quotes around mydb and around the select statement. If I
> don't have the single quotes around the select statement it returns back
an
> error stating that the table Select does not exist.
> 
> And getPop() is a function that I wrote. If you'd like that code, let me
> know.
> 
> Thank you,
> Frances Collier
> 
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of TECHER
> David
> Sent: Monday, September 11, 2006 4:56 PM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] ogr2ogr creating shapefile
> 
> Hi Frances,
> 
> I'm used to using ogr2ogr but I've never had problems.
> 
> Never see this error before! For me to understanding what is getPop() in
> your query???
> 
> What about using pgsql2shp instead of ogr2ogr ??? (see
> http://postgis.refractions.net/docs/ch04.html#id2524054)
> 
> example: pgsql2shp -f your_shapefile.shp your_database your_query
> 
> for us to see if U have error too with this tool
> 
> For the error U give, it seems better to ask on gdal mailing list!
> 
> 
> Frances Collier a écrit :
> 
> >Hello all,
> >
> >I have been trying to figure out how to create a shapefile using ogr2ogr.
I
> >haven't been able to find much on it through google and the user pages so
I
> >thought one of you might be able to help.
> >
> >Here's my statement:
> >
> >ogr2ogr -f "ESRI Shapefile" test "PG:dbname=mydb host=localhost
> >user=postgres password=postgres" -sql "Select pop from getPop()"
> >
> >When I click enter I get an Application Error that states the memory
could
> >not be "read". I'm sure it's in my syntax, but I can't figure it out. I
> >would like to know if there are other ways to accomplish this as well. 
> >
> >Thank you,
> >Frances Collier
> >
> >
> >
> >_______________________________________________
> >postgis-users mailing list
> >postgis-users at postgis.refractions.net
> >http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >  
> >
> 
> 
> -- 
> --david;
> http://www.postgis.fr
> http://www.davidgis.fr
> 
> 
> 	
> 
> 	
> 		
>
___________________________________________________________________________ 
> Dcouvrez un nouveau moyen de poser toutes vos questions quelque soit le
> sujet ! 
> Yahoo! Questions/Rponses pour partager vos connaissances, vos opinions et
> vos expriences. 
> http://fr.answers.yahoo.com 
> 
> _______________________________________________
> 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