[gdal-dev] Problem with OGRCreateCoordinateTransformation

Frank Warmerdam warmerdam at pobox.com
Fri Apr 10 10:36:43 EDT 2009


Reinaldo Escada Chohfi wrote:
> Hello all,
> 
> We place this piece of code to test how coordinate transformation works 
> with OGR.
> 
>         OGRSpatialReference oSourceSRS, oTargetSRS;
>         OGRCoordinateTransformation *poCT;
>         double  x1, y1;
> 
>         oSourceSRS="EPSG:4326";
>         oTargetSRS="EPSG:4989";
> 
>         poCT = OGRCreateCoordinateTransformation( &oSourceSRS, 
> &oTargetSRS );
>         x1 = -45.859485925833;
>         y1 = -23.2101365278;
> 
>         printf("%lf %lf \n",x1,y1);
>        
>         if( poCT == NULL || !poCT->Transform( 1, &x1, &y1 ) )
>             printf( "Transformation failed.\n" );
>         else
>             printf( "(-45.859485925833,-23.2101365278) -> (%f,%f)\n",
>                      x1, y1 );
> 
> The program compiles fine, but it gives the following runtime error:
> 
> ERROR 6: Unable to load PROJ.4 library (proj.dll), creation of
> OGRCoordinateTransformation failed.
> 
> Isn't PROj.4 (proj.lib) built in OGR?

Reinaldo,

In the default configuration PROJ.4 is loaded at runtime rather than
being linked against at build time.  This was a slightly peculiar and
unusual decision on my part many years ago.  Do you have PROJ.dll available
in your PATH?  If not, you will need to add it for reprojection support.

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    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list