[postgis-users] Loading data with ogr2ogr
Pål Kristensen
pal.kristensen at statkart.no
Thu Dec 13 23:56:30 PST 2007
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 at 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 at 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
--
View this message in context: http://www.nabble.com/Loading-data-with-ogr2ogr-tp14313629p14331472.html
Sent from the PostGIS - User mailing list archive at Nabble.com.
More information about the postgis-users
mailing list