[postgis-users] ogr2ogr creating shapefile
TECHER David
davidtecher at yahoo.fr
Tue Sep 12 15:34:06 PDT 2006
Just for note
U can specify the geometry column U want with option -g with pgsql2shp
do a
pgsql2shp --help
to have more info
Frances Collier a écrit :
>Okay, I didn't know that it needed an attribute. Thanks for the info.
>Frances
>
>-----Original Message-----
>From: postgis-users-bounces at postgis.refractions.net
>[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Bruce
>Rindahl
>Sent: Tuesday, September 12, 2006 2:55 PM
>To: 'Frances Collier'
>Cc: 'PostGIS Users Discussion'
>Subject: RE: [postgis-users] ogr2ogr creating shapefile
>
>Your function getpop() returns two geometries - pnt and pop. I wanted to
>confirm that with the first query. A shapefile needs one geometry and at
>least one attribute. As an example I just created columns of the x and y
>coordinates of the pnt geometry and the pop for the shapefile. X() and Y()
>are standard PostGIS functions.
>
>Bruce
>
>-----Original Message-----
>From: Frances Collier [mailto:fcollier at preparedresponse.com]
>Sent: Tuesday, September 12, 2006 3:49 PM
>To: rindahl at lrcwe.com
>Subject: RE: [postgis-users] ogr2ogr creating shapefile
>
>
>That worked, of course, and thank you very much. The table now has the FID,
>shape, X, and Y in it. I understand what they all are, but I don't
>understand why. If you don't mind too much, would you explain (or point me
>to an explanation of) why the x and y needed to be included?
>-Frances Collier
>
>-----Original Message-----
>From: Bruce Rindahl [mailto:rindahl at lrcwe.com]
>Sent: Tuesday, September 12, 2006 2:24 PM
>To: 'Frances Collier'
>Subject: RE: [postgis-users] ogr2ogr creating shapefile
>
>Now try:
>Pgsql2shp -f D:\myshapefile.shp -u postgres -P postgres mydb 'select pop,
>X(pnt) as x, y(pnt) as y from getpop()'
>
>This should give you a shapefile of the buffers and the x and y coordinates
>of the points as attributes in the table.
>Bruce
>
>
>-----Original Message-----
>From: Frances Collier [mailto:fcollier at preparedresponse.com]
>Sent: Tuesday, September 12, 2006 3:04 PM
>To: rindahl at lrcwe.com
>Subject: RE: [postgis-users] ogr2ogr creating shapefile
>
>Sure:
>
>pnt|pop
>0101000020FF7F000034BBEEAD48635EC06E3480B7402C4840|"0103000020FF7F0000010000
>002200000034BBEEAD48435EC06E3480B7402C4840B1C31E16E6435EC01E01625BC41F484010
>881F42B8455EC09E88D9D4C213484049ABC547AD485EC076DB0C41B2084840CA39880FA84C5E
>C0533AB37AFFFE47409609B57281515EC0741B2EEB09F74740995F9BBC09575EC0DED2E1DF1F
>F147407F9BDF7F0A5D5EC0D047E0877BED474008B5EEAD48635EC06E3480B740EC4740CFCEFD
>DB86695EC0FF42E0877BED4740680B429F876F5EC06CC9E1DF1FF147408F6228E90F755EC0BD
>0D2EEB09F74740E433554CE9795EC0DF28B37AFFFE474044C41714E47D5EC0F0C60C41B20848
>409FE9BD19D9805EC0D171D9D4C21348404FB0BE45AB825EC0E9E8615BC41F484034BBEEAD48
>835EC0BF1B80B7402C484020B5BE45AB825EC0884F9E13BD38484011F3BD19D9805EC070C926
>9ABE444840FAD11714E47D5EC0E178F32DCF4F48405845554CE9795EC0151D4DF48159484015
>7728E90F755EC0B23FD283776148403622429F876F5EC08C8C1E8F6167484004E7FDDB86695E
>C03B1C20E7056B4840B7CDEEAD48635EC06E3480B7406C4840B4B3DF7F0A5D5EC0AE2A20E705
>6B484066769BBC09575EC0E2A81E8F616748401C1EB57281515EC0D568D283776148403E4B88
>0FA84C5EC071514DF48159484000B9C547AD485EC072B6F32DCF4F484082911F42B8455EC0D9
>0D279ABE44484082C81E16E6435EC028989E13BD38484034BBEEAD48435EC0CB6580B7402C48
>4034BBEEAD48435EC06E3480B7402C4840"
>
>I separated the columns with the "|" symbol.
>Frances Collier
>
>-----Original Message-----
>From: Bruce Rindahl [mailto:rindahl at lrcwe.com]
>Sent: Tuesday, September 12, 2006 1:44 PM
>To: 'Frances Collier'
>Subject: RE: [postgis-users] ogr2ogr creating shapefile
>
>Can you post the result of:
>Select * from mypop() limit 1
>Bruce Rindahl
>
>-----Original Message-----
>From: Frances Collier [mailto:fcollier at preparedresponse.com]
>Sent: Tuesday, September 12, 2006 2:40 PM
>To: rindahl at lrcwe.com; 'PostGIS Users Discussion'
>Subject: RE: [postgis-users] ogr2ogr creating shapefile
>
>
>Bruce,
>
>Well, I fixed the query so I'm only calling one of the two columns ("select
>pop from getpop()"), and I still get the same error. Do I need to be
>querying another column in addition to the geometry one? Perhaps it's the
>way I've written my function.
>
>First I created my own type: myset(pnt geometry, pop geometry). My function
>returns a setof myset. In the function, I take a linestring, get the
>individual points, and then simply call the buffer function on each point.
>(Does this make enough sense?) So, I guess I'm really asking if the myset
>type is the problem.
>
>Thank you for your time.
>Frances Collier
>
>-----Original Message-----
>From: postgis-users-bounces at postgis.refractions.net
>[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Bruce
>Rindahl
>Sent: Tuesday, September 12, 2006 1:10 PM
>To: 'PostGIS Users Discussion'
>Subject: RE: [postgis-users] ogr2ogr creating shapefile
>
>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
>
>
>
>_______________________________________________
>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
>
>
>
--
--david;
http://www.postgis.fr
http://www.davidgis.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060913/cba81c54/attachment.html>
More information about the postgis-users
mailing list