[gdal-dev] Strange proj.4 problem with ogr2ogr

Roger André randre at gmail.com
Tue Dec 11 12:52:55 EST 2007


Well, the mystery deepens, as the following script using osr for
reprojection works:

#! /usr/bin/python

import ogr
import osr

# CREATE WKT STRING OF POINT COORDS
sample = (' 776041.000', '3386618.000')
x = sample[0]
y = sample[1]
wkt = 'POINT(%s %s)' % (x, y)

# CREATE PROJECTION OBJECTS
utm16N = osr.SpatialReference ()
utm16N.ImportFromEPSG(26916)
wgs84 = osr.SpatialReference()
wgs84.ImportFromEPSG(4326)

# CREATE OGR POINT OBJECT, ASSIGN PROJECTION, REPROJECT
point = ogr.CreateGeometryFromWkt(wkt)
point.AssignSpatialReference(utm16N)
point.TransformTo(wgs84)

print wkt
print point

--> output:
POINT( 776041.000 3386618.000)
POINT (-84.121611219545088 30.5802861582041)

I wonder, maybe I'm just being dumb and am using incorrect usgae syntax for
ogrtoogr?  Here's the command I gave:

ogr2ogr -t_srs "EPSG:4326" 4326_pot2kcl_combined.shp pot2kcl_combined.shp

--> output:
ERROR 6: Unable to load PROJ.4 library (libproj.dll), creation of
OGRCoordinateTransformation failed.
Failed to create coordinate transformation between the
following coordinate systems.  This may be because they
are not transformable, or because projection services
(PROJ.4 DLL/.so) could not be loaded.
Source:
PROJCS["NAD_1983_HARN_StatePlane_Washington_South_FIPS_4602",
    GEOGCS["GCS_North_American_1983_HARN",
        DATUM["NAD83_High_Accuracy_Regional_Network",
            SPHEROID["GRS_1980",6378137.0,298.257222101]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree", 0.0174532925199433]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["False_Easting",1640416.666666667],
    PARAMETER["False_Northing",0.0],
    PARAMETER["Central_Meridian",- 120.5],
    PARAMETER["Standard_Parallel_1",45.83333333333334],
    PARAMETER["Standard_Parallel_2",47.33333333333334],
    PARAMETER["Latitude_Of_Origin",45.33333333333334],
    UNIT["Foot_US", 0.3048006096012192]]
Target:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        TOWGS84[0,0,0,0,0,0,0],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.01745329251994328 ,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]
---



On Dec 10, 2007 4:59 PM, Frank Warmerdam < warmerdam at pobox.com> wrote:

> Roger André wrote:
> > I'm having an interesting problem when trying to use ogr2ogr to
> > reproject from one coordinate system to another.  What makes it
> > interesting is that gdalwarp works properly on the same system.  With
> > ogr2ogr I get an error that says,
> >
> > "ERROR 6: Unable to load PROJ.4 library (libproj.dll), creation of
> > OGRCoordinateTransformation failed.
> > Failed to create coordinate transformation between the
> > following coordinate systems.  This may be because they
> > are not transformable, or because projection services
> > (PROJ.4 DLL/.so) could not be loaded."
>
> Roger,
>
> GDAL and OGR both use the OGRCoordinateTransformation class to load
> and call PROJ.4.  So I can't explain the behaviour you are seeing.
>
> 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<http://pobox.com/%7Ewarmerdam>
> and watch the world go round - Rush    | President OSGeo, http://osgeo.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20071211/833a50e8/attachment-0001.html


More information about the gdal-dev mailing list