[gdal-dev] Transform from lat/long/elevation to 3d sphere

Adam Nowacki nowak at xpam.de
Fri Jul 3 08:08:40 EDT 2009


Something like:
OGRSpatialReference sr;
sr.SetFromUserInput("+proj=geocent");

Christopher Hunt wrote:
> Sorry for the hopefully not so dumb question here.
> 
> If I want to transform from one projection to a projection of the earth 
> in 3D, how would I set up my target srs?
> 
> I want to take a WGS-84 lat/long/elevation and have an x,y,z returned in 
> metres.
> 
> Here's my present code:
> 
>   // Read the image's projection
>   OGRSpatialReference projSpatialReference(dataset->GetProjectionRef());
>   scoped_ptr<OGRSpatialReference> 
> latLongSpatialReference(projSpatialReference.CloneGeogCS());
>   transform = 
> OGRCreateCoordinateTransformation(latLongSpatialReference.get(), 
> &projSpatialReference);
> 
> ...and of course that transforms from lat/long/elevation to the 
> projection srs nicely. What I'm looking for is a way to specify the 
> target srs so that it yields the x, y, z values for WGS84 3d sphere i.e. 
> the earth.


More information about the gdal-dev mailing list