[postgis-users] pgsql2shp syntax - sentence construction

SenTnel elvin.pimentel at gmail.com
Mon Jun 2 17:46:25 PDT 2008


Thanks Stephen! 

I must admit that Im not good at this, but Im determined to mantain my
city's database correcting names and roads classifications, etc., that's why
I need to take the postgres data and convert it to shapefile, then correct
things with arcmap, then drop the old postgres data and then re-convert the
updated shapefile to postgres, is this the way you would do it? 

I have one more question about this updating, and this is a "select"
question, (I'll remind you that Im an ignorant in this matters) would you
please construct an sql sentence to achive this:

In mydatabase, myschema, mytable there's a "street" column, where the street
names are, let's say I want to correct a misspeled name, for example, "Geoge
Washington", and want to correct it to "George Washington", how do you write
the select?

Thanks again!

 


Stephen Woodbridge wrote:
> 
> SenTnel wrote:
>> Hi! Im working with postgres and geoserver but im just not good at sql
>> statements, none the less in construction sentences in postgres, and I
>> would
>> like to create a shapefile from a table in postgres and don't want to
>> make a
>> costly mistake, so if you help me achieve this using pgsql2shp: 
>> 
>> database name: mydatabase
>> schema: myschema
>> table: mytable
>> 
>> shapefile to be created: updatedshp
>> 
>> database user: postgres
>> password: any
>> 
>> can you help me with the syntax to achieve the shapefile containing all
>> of
>> the data (and geom) in such table?
>> 
>> Thanks !
> 
> SenTel,
> 
> pgsql2shp is not a SQL statement it is a command line tool:
> 
> woodbri at carto:~$ pgsql2shp
> RCSID: $Id: pgsql2shp.c,v 1.82 2006/01/16 10:42:57 strk Exp $
> USAGE: pgsql2shp [<options>] <database> [<schema>.]<table>
>         pgsql2shp [<options>] <database> <query>
> 
> OPTIONS:
>    -f <filename>  Use this option to specify the name of the file
>       to create.
>    -h <host>  Allows you to specify connection to a database on a
>       machine other than the default.
>    -p <port>  Allows you to specify a database port other than the
> default.
>    -P <password>  Connect to the database with the specified password.
>    -u <user>  Connect to the database as the specified user.
>    -g <geometry_column> Specify the geometry column to be exported.
>    -b Use a binary cursor.
>    -r Raw mode. Do not assume table has been created by
>       the loader. This would not unescape attribute names
>       and will not skip the 'gid' attribute.
>    -k Keep postgresql identifiers case.
> 
> 
> So you might use it like:
> 
>> pgsql2shp -f updatedshp.shp -h localhost -u postgres mydatabase
>> myschema.mytable
> 
> Have fun,
>    -Steve W
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 

-- 
View this message in context: http://www.nabble.com/pgsql2shp-syntax---sentence-construction-tp17613265p17613906.html
Sent from the PostGIS - User mailing list archive at Nabble.com.




More information about the postgis-users mailing list