[Gdal-dev] problem with ogr2ogr -f PostgreSQL...

Gowens, Colin Colin.Gowens at co.fulton.ga.us
Wed Mar 8 17:26:38 EST 2006


Thom,

When you select the geometry of a record in PostGIS with SQL it will
show the SRID.  An SRID = -1 is the default "nothing is defined", so you
will need to set the SRID using the setsrid() function in PostGIS.  EPSG
codes are accepted.  Also, there may be a table in the Public schema
(geometry_columns on our install) that holds the SRIDs for all of the
geo_tables in the db.  If this is the case, then each geo_table will
need to be "registered" using a register_geometry_table() function. 


Colin Gowens
Geographic Information Systems
Fulton County, Georgia
email:  colin.gowens at co.fulton.ga.us

-----Original Message-----
From: "Ethan Alpert" <ealpert at digitalglobe.com>
Subject: RE: [Gdal-dev] problem with ogr2ogr -f PostgreSQL...
To: "Thom DeCarlo" <t.r.decarlo at larc.nasa.gov>,
	<gdal-dev at lists.maptools.org>
Message-ID:
	
<8B319E5A30FF4A48BE7EEAAF609DB23344CA11 at COMAIL01.digitalglobe.com>
Content-Type: text/plain;	charset="us-ascii"



SRID == Spatial Reference ID

It defines the coordinate system and projection of your data. Once you
get to the mapserver part you'll really need to understand it to get
maps displayed or to do spatial operations on your data like intersect,
etc...

There is a mapserver user list: MAPSERVER-USERS at LISTS.UMN.EDU

-e

-----Original Message-----
From: gdal-dev-bounces at lists.maptools.org
[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Thom DeCarlo
Sent: Wednesday, March 08, 2006 1:32 PM
To: gdal-dev at lists.maptools.org
Subject: RE: [Gdal-dev] problem with ogr2ogr -f PostgreSQL...

Ethan (and everybody else...),
It looks like you folks have already hashed out all of my problems. ;-)
I
think the *real* problem is that I'm trying to learn SQL, PostgreSQL,
PostGIS, MapServer, and Apache all in one swell foop. 

That said... I was trying to load the shapefiles into a PostgreSQL
database
using the ogr2ogr command. I was blindly following the examples given on
the
PostgreSQL page of the gdal.org site.
(http://www.gdal.org/ogr/drv_pg.html)
The example there says:

% ogr2ogr -f PostgreSQL PG:dbname=warmerda tiger_michigan \
     -lco OVERWRITE=yes CompleteChain
% ogr2ogr -update -append -f PostgreSQL PG:dbname=warmerda tiger_ohio \
     CompleteChain

Unfortunately, as you show in your example, the commands should actually
look like this:

% ogr2ogr -f PostgreSQL PG:dbname=warmerda tiger_michigan \
     -lco OVERWRITE=yes -nln CompleteChain
                        ^^^^
% ogr2ogr -update -append -f PostgreSQL PG:dbname=warmerda tiger_ohio \
     -nln CompleteChain
     ^^^^

When I add the "-nln" the new lay is properly created and appended. This
error is duplicated on the PostGIS OGR Wiki page
http://postgis.refractions.net/support/wiki/index.php?OGR%20Examples

Now if I can just figure out what you mean by that "SRID" thingy....

Thom

--
Thom DeCarlo
-------------------------------------------------------
     That Which Does Not Kill Me
       Can Still Hurt Really Bad.

> -----Original Message-----
> From: Ethan Alpert [mailto:ealpert at digitalglobe.com]
> Sent: Tuesday, March 07, 2006 5:55 PM
> To: Thom DeCarlo; gdal-dev at lists.maptools.org
> Subject: RE: [Gdal-dev] problem with ogr2ogr -f PostgreSQL...
> 
> 
> Are you trying to load the shapefiles? If so post your command line.
> 
> 
> Should be something like:
> 
> Ogr2ogr -f PostgresSQL "PG:dbname=<dbname>" your_shapefile.shp -nln
> layer
> 
> There are many creation options -lco's you may want to use but it
would
> be helpful to know what command line you used as well as what version
of
> GDAL.
> 
> One important thing is to makesure you have granted your database user
> permissions to modify the postgis geometry_columns table. But you'd
get
> an error if that happened.
> 
> -e
> 
> -----Original Message-----
> From: Thom DeCarlo
> Sent: Tuesday, March 07, 2006 3:22 PM
> To: gdal-dev at lists.maptools.org
> Subject: [Gdal-dev] problem with ogr2ogr -f PostgreSQL...
> 
> I've set up my PostGIS-enabled PostgreSQL database and created a
dataset
> called "spatial". I have several shapefiles that I want to load into a
> single layer. I found the instructions on the gdal website but when I
> specify a layername at the end of the ogr2ogr command it quietly
fails.
> That
> is, no messages of any kind either at the command line nor in the
pgsql
> logfile. If I don't specify a layername the command works just fine.
> 
> Are there known problems with this function? I'm using PostGIS 1.1.0
and
> PostgreSQL 8.1.1 on RHEL3.
> 
> Thanks,
> Thom
> 
> --
> Thom DeCarlo
> -------------------------------------------------------
>              Who is General Failure
>          and why is he reading my disk?
> 
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060308/c831b588/attachment.html


More information about the Gdal-dev mailing list