pgsql2shp command...need help

Paul Spencer pspencer at DMSOLUTIONS.CA
Thu Mar 10 06:28:05 EST 2005


Wokar,

using pgAdmin, you can run sql commands.  You add a geometry column to
your existing table by running:

SELECT AddGeometryColumn( 'hotspots', 'the_geom', -1, 'POINT', 2 );

Paul

w m wrote:
> Thanks Paul:)
> Okay everthing is installed and its up and running.
> now the point that im stuck at is that im not sure what to put in my geometry column.
> im not using sql commnads. im using the pgadmin interface
>
>
> but at the top it gives me this error
>
> SQL error:
>
> ERROR:  column "latitude" does not exist
>
>
>
> In statement:
> INSERT INTO "geometry_columns" ("f_table_catalog", "f_table_schema", "f_table_name", "f_geometry_column", "coord_dimension", "srid", "type", "attrelid", "varattnum", "stats")
>
> VALUES (Latitude, public, 'Hotspots', circle, '45.5177', '1', polygon, '1', '1', '1')
>
>
>
> so it says that insert failed
>
> f_table_catlog is a clomun from my  table??? If yea thats why i put latitude. the column latitude does exist in my table called hotspots
>
> do i have to worry about entering values in every field?
>
> and what exactly has to go in coord_dimension...can i put any values...or i have to put the real latitude ( or my values in the latitude?)  is it supposed to be in the form of x, y coordiantes??
>
>
>
> Thanks
>
>  Wokar
>
>
>
>
>
>
>
>
>
> Paul Spencer <pspencer at dmsolutions.ca> wrote:
> wokar,
>
> pgsql2shp is distributed with the postgis extension to postgres. When
> you have a properly configured postgis database, you can create geometry
> columns in your tables and they represent real geometries. Your table
> has no 'geometry' column so the utility doesn't know how to create a
> shape file for it ... so it just created the attribute table.
>
> I will assume you have two columns that represent the latitude and
> longitude. You need to review the postgis documentation on adding
> postgis support into your database. There are several steps, including
> (but not limited to) running the contents of postgis.sql and
> spatial_ref_sys.sql. If you haven't done this yet, you will have to.
>
> Once you have spatial support installed, you can then create a new
> geometry column in your table (again, the postgis documentation has the
> necessary steps).
>
> Once you have created the geometry column, you can put real geometries
> in using an sql statement like:
>
> update hotspots set the_geom=GeometryFromText( "POINT(" ||
> longitude::STRING || " " || latitude::STRING || ")", -1);
>
> which will create a POINT geometry from your lon/lat fields. Note the
> syntax may be wrong and you may have to change it depending on how you
> are storing the lon/lat values.
>
> Once you have the_geom populated, you can run pgsql2shp :)
>
> Cheers
>
> Paul
>
> w m wrote:
>
>>Hi,
>>Im trying to use the pgsql2shp command to convert a very small table from pgadmin
>>
>>My database is called montreal and the table is called hotspots
>>
>>in the root dierectory i do the following.
>>
>>i get the following error
>>
>>-bash-2.05b$ pgsql2shp Montreal Hotspots
>>Initializing... No geometry column found.
>>The DBF file will be created but not the shx or shp files.
>>Done.
>>Dumping: XX [4 rows].
>>
>>What am I doing wrong????
>>where is the geometry column supposed to be?
>>and where does this newly created DBF file reside?
>>Thanks
>>
>>wokar
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Tired of spam? Yahoo! Mail has the best spam protection around
>>http://mail.yahoo.com
>
>

--
+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+



More information about the mapserver-users mailing list