Loading data with ogr2ogr

View: New views
4 Messages — Rating Filter:   Alert me  

Loading data with ogr2ogr

by Pål Kristensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

I have loaded some data from ArcSDE 9.1 to PostGIS using the ogr2ogr utility. The load statements typically looks like this:

ogr2ogr -nlt LINESTRING -nln n50_begrensningskurve -lco GEOMETRY_NAME=the_geom -a_srs EPSG:32633 -f PostgreSQL PG:"dbname=kartdata user=**** host=***.***.***.***" SDE:***.***.***.***,5157,,sde_user,sde_password,n50.begrensningskurve

The problem is that the resulting table in PostGIS has a SRID value of 1, but it should be 32633. I have tried to include the s_srs option to override the source projection, which by the way is 32633, but that did not do any difference.

I have used the UpdateGeometrySRID function to change the SRID after loading, but that seems like a workaround that really not should be necessary.

Is there something I've missed that causes this behavior? Any ideas?

Regards,
Pål Kristensen

RE: Loading data with ogr2ogr

by Obe, Regina DND\MIS :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Not sure if it makes a difference, but I usually quote the "EPSG:32633",  but I've never imported from SDE so could be a totally different issue.

Hope that helps,
Regina

-----Original Message-----
From: postgis-users-bounces@... [mailto:postgis-users-bounces@...] On Behalf Of Pål Kristensen
Sent: Thursday, December 13, 2007 6:17 AM
To: postgis-users@...
Subject: [postgis-users] Loading data with ogr2ogr


Hi!

I have loaded some data from ArcSDE 9.1 to PostGIS using the ogr2ogr
utility. The load statements typically looks like this:

ogr2ogr -nlt LINESTRING -nln n50_begrensningskurve -lco
GEOMETRY_NAME=the_geom -a_srs EPSG:32633 -f PostgreSQL PG:"dbname=kartdata
user=**** host=***.***.***.***"
SDE:***.***.***.***,5157,,sde_user,sde_password,n50.begrensningskurve

The problem is that the resulting table in PostGIS has a SRID value of 1,
but it should be 32633. I have tried to include the s_srs option to override
the source projection, which by the way is 32633, but that did not do any
difference.

I have used the UpdateGeometrySRID function to change the SRID after
loading, but that seems like a workaround that really not should be
necessary.

Is there something I've missed that causes this behavior? Any ideas?

Regards,
Pål Kristensen
--
View this message in context: http://www.nabble.com/Loading-data-with-ogr2ogr-tp14313629p14313629.html
Sent from the PostGIS - User mailing list archive at Nabble.com.

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Loading data with ogr2ogr

by Frank Warmerdam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Pål Kristensen wrote:

> Hi!
>
> I have loaded some data from ArcSDE 9.1 to PostGIS using the ogr2ogr
> utility. The load statements typically looks like this:
>
> ogr2ogr -nlt LINESTRING -nln n50_begrensningskurve -lco
> GEOMETRY_NAME=the_geom -a_srs EPSG:32633 -f PostgreSQL PG:"dbname=kartdata
> user=**** host=***.***.***.***"
> SDE:***.***.***.***,5157,,sde_user,sde_password,n50.begrensningskurve
>
> The problem is that the resulting table in PostGIS has a SRID value of 1,
> but it should be 32633. I have tried to include the s_srs option to override
> the source projection, which by the way is 32633, but that did not do any
> difference.
>
> I have used the UpdateGeometrySRID function to change the SRID after
> loading, but that seems like a workaround that really not should be
> necessary.
>
> Is there something I've missed that causes this behavior? Any ideas?

Pål,

Can you confirm that the spatial_ref_sys table is populated?  Normally
ogr2ogr attempts to find an exact match for the coordinate system in
spatial_ref_sys (based on comparing the WKT strings) and if one is not
found it should try and create a new spatial_ref_sys entry with the SRID
being one higher than the highest currently used value.

The fact that it selected "1" suggests to me that the table might be
empty.

Note that OGR does not, and will not, make the assumption that SRIDs
map 1:1 to EPSG codes.   The trick really is to ensure that the WKT
matches something exactly in the spatial_ref_sys.  So for the -s_srs
(or -a_srs) you should use the exact string from the spatial_ref_sys.
This can be stored in a file.

I'd like to have a layer creation option to select a particular SRID
by SRID number for the PG driver, but that hasn't been implemented yet.

Should my assumptions about the spatial_ref_sys table be wrong, please
consider filing a bug against GDAL/OGR promptly.  We have only a few
days before the 1.5.0 release to fix any serious problems in the
postgis driver.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@...
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Loading data with ogr2ogr

by Pål Kristensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Frank Warmerdam-2 wrote:
Pål Kristensen wrote:
> Hi!
>
> I have loaded some data from ArcSDE 9.1 to PostGIS using the ogr2ogr
> utility. The load statements typically looks like this:
>
> ogr2ogr -nlt LINESTRING -nln n50_begrensningskurve -lco
> GEOMETRY_NAME=the_geom -a_srs EPSG:32633 -f PostgreSQL PG:"dbname=kartdata
> user=**** host=***.***.***.***"
> SDE:***.***.***.***,5157,,sde_user,sde_password,n50.begrensningskurve
>
> The problem is that the resulting table in PostGIS has a SRID value of 1,
> but it should be 32633. I have tried to include the s_srs option to override
> the source projection, which by the way is 32633, but that did not do any
> difference.
>
> I have used the UpdateGeometrySRID function to change the SRID after
> loading, but that seems like a workaround that really not should be
> necessary.
>
> Is there something I've missed that causes this behavior? Any ideas?

Pål,

Can you confirm that the spatial_ref_sys table is populated?  Normally
ogr2ogr attempts to find an exact match for the coordinate system in
spatial_ref_sys (based on comparing the WKT strings) and if one is not
found it should try and create a new spatial_ref_sys entry with the SRID
being one higher than the highest currently used value.

The fact that it selected "1" suggests to me that the table might be
empty.

Note that OGR does not, and will not, make the assumption that SRIDs
map 1:1 to EPSG codes.   The trick really is to ensure that the WKT
matches something exactly in the spatial_ref_sys.  So for the -s_srs
(or -a_srs) you should use the exact string from the spatial_ref_sys.
This can be stored in a file.

I'd like to have a layer creation option to select a particular SRID
by SRID number for the PG driver, but that hasn't been implemented yet.

Should my assumptions about the spatial_ref_sys table be wrong, please
consider filing a bug against GDAL/OGR promptly.  We have only a few
days before the 1.5.0 release to fix any serious problems in the
postgis driver.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
Hi Frank!

Thanks a lot for the help, your assumption was totally correct. For some reason the spatial_ref_sys table was empty, and a new entry with SRID 1 and the right WKT was created. After population the spatial_ref_sys table the data loading completed correctly.

Thanks again for the help!

Regards,
Pål Kristensen
LightInTheBox - Buy quality products at wholesale price