[gdal-dev] Problem with OGRCreateCoordinateTransformation
Howard Butler
hobu.inc at gmail.com
Fri Apr 10 00:25:51 EDT 2009
On Apr 9, 2009, at 9:38 PM, 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";
I don't see how this could compile. You need to instantiate
oSourceSRS and oTargetSRS with OSRNewSpatialReference, and then use a
call like OSRImportFromEPSG or OSRSetFromUserInput on the objects to
get valid SpatialReferences.
>
> 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?
>
No, it is loaded at runtime unless you use have PROJ_FLAGS = -
DPROJ_STATIC in your nmake.opt when you compile. Otherwise, you must
ensure that GDAL_DATA and/or PROJ_LIB environment variables are set,
and the necessary data can be found in those locations *and* the
proj.dll that was linked with GDAL at compile time is able to be found
at runtime.
More information about the gdal-dev
mailing list