[postgis-users] pgsql2shp error

smas036 sina.masoud.ansari at gmail.com
Tue Aug 24 02:17:37 PDT 2010


Hi Jeff, 

Thanks for your reply.
The data was correct when I just used the table name.
I have tried working with just the integer but I was still getting similar
errors.
I decided to just use a temp table, update that with a normal query and
output the temp table as the shapefile.

Thanks for your help!

Sina

Jeff Adams-9 wrote:
> 
> Did you verify that the data in the shapefile is correct when you run the
> command with just the table name?
> 
> Hang on a second...  WHERE 'ID' < '20' is never true.  That's why you're
> getting an empty table.  'ID' is a string, as is '20'.  I think you mean
> to
> say where your ID column value is less than 20, correct?  Single quotes
> mean
> 'this is a string'.
> 
> Are your ID values strings (varchars) or integers?  If integers, it'll be
> faster to use 20 as an integer (without the single quotes) rather than as
> a
> string.
> 
> Maybe the problem is with 'id' by itself, so try fully qualifying it:
> 
> pgsql2shp -f [path] -h [myhost] -p [port] -u [user] -P [password]
> [database]
>  "SELECT * FROM table1 WHERE table1.id < 20"
> 
> On Wed, Aug 11, 2010 at 5:50 AM, smas036
> <sina.masoud.ansari at gmail.com>wrote:
> 
>>
>> Thanks for the replies, the most promising command so far is:
>>
>> pgsql2shp -f [path] -h [myhost] -p [port] -u [user] -P [password]
>> [database]
>>  "SELECT * FROM table1 WHERE 'ID' < '20'"
>>
>> Which has the output:
>>
>> Preparing table for user query... Done.
>> Initializing... WARNING: Cannot determine spatial reference (empty table
>> or
>> unknown spatial ref). No prj file will be generated.
>> ERROR: Cannot determine geometry type (empty table)
>>
>> I think the query is correct as other combinations if single and double
>> quotes around field values produce
>> "...column does not exist..." or "The system cannot find the file
>> specified."
>>
>> I believe the command parameters before the query are correct as the
>> command
>> without a query:
>>
>> pgsql2shp -f [path] -h [myhost] -p [port] -u [user] -P [password]
>> [database]
>> [table]
>>
>> works fine.
>>
>> It would be possible to produce a table from a query and use this command
>> but I wonder if there is a performance loss in doing so...
>>
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/pgsql2shp-error-tp29384180p29406665.html
>> Sent from the PostGIS - User mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> 
> 
> 
> -- 
> Jeff Adams
> 
> Azavea (formerly Avencia)  |  340 N 12th St, Ste 402, Philadelphia, PA
> jadams at azavea.com  | T 215.701.7717  | F 215.925.2663
> Web azavea.com  |  Blog azavea.com/blogs  |  Twitter
> @azavea<http://twitter.com/azavea>
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 

-- 
View this message in context: http://old.nabble.com/pgsql2shp-error-tp29384180p29520124.html
Sent from the PostGIS - User mailing list archive at Nabble.com.




More information about the postgis-users mailing list