[gdal-dev] Create Coordinate Transformation always returns NULL

Clay, Bruce bclay at ball.com
Thu Mar 13 09:54:38 EDT 2008


Mystery solved - at least the initial part - My GDAL / OGR build does
not have Proj4 included as a static library and I did not have the DLL
in the execution path.

 

Is there a way to query OGR to get an error message or code that
explains why an operation fails?

 

Bruce

________________________________

From: gdal-dev-bounces at lists.osgeo.org
[mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Clay, Bruce
Sent: Wednesday, March 12, 2008 5:33 PM
To: gdal-dev at lists.osgeo.org
Subject: [gdal-dev] Create Coordinate Transformation always returns NULL

 

I am trying to create a transformation from WGS 84 to a projected
system.  I have tried several but create transform always returns NULL.

The code I am using is essentially the reverse sequence as shown in the
OSR tutorial.  That is that the example went from a projected frame to a
geodetic frame.

The returned status for each of the steps is 0 so it looks like
everything should work and this type of transform is fairly common so I
would think it should be supported by proj4 but I don't see anything in
the proj4 docs that describe what types are supported.

 

Any ideas would be greatly appreciated

 

Bruce

 

////////////////////////////////////////////////////////////////////////
///////

OGRCoordinateTransformation *GdalWrapper::CreateWellKnownTransformation(

                  const char *srcWngcsSrs, const char *destWngcsSrs)

{

      int status = -1;

      OGRErr ogrStatus;

      OGRCoordinateTransformation *coordTransPtr = NULL;

 

      OGRSpatialReference srcSpatialRef;

      OGRSpatialReference destSpatialRef;

 

      ogrStatus = srcSpatialRef.SetWellKnownGeogCS("WGS84");

 

      if (ogrStatus == 0)

      {

            ogrStatus = destSpatialRef.SetProjCS("UTM 17 / WGS84" );

            ogrStatus = destSpatialRef.SetWellKnownGeogCS( "WGS84" );

            ogrStatus = destSpatialRef.SetUTM( 17, TRUE );

 

            if (ogrStatus == 0)

            {

                  coordTransPtr = OGRCreateCoordinateTransformation(

                              &srcSpatialRef, &destSpatialRef);

            }

      }

      return(coordTransPtr);

}

 



This message and any enclosures are intended only for the addressee.
Please  
notify the sender by email if you are not the intended recipient.  If
you are  
not the intended recipient, you may not use, copy, disclose, or
distribute this  
message or its contents or enclosures to any other person and any such
actions  
may be unlawful.  Ball reserves the right to monitor and review all
messages  
and enclosures sent to or from this email address.



This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080313/9b7733e1/attachment.html


More information about the gdal-dev mailing list