# Finding the 3D points of Latitude Longitude

Eagerly waiting for your early response.

With Best Regards,

Atif

Eagerly waiting for your early response.

With Best Regards,

Atif

It looks like you're new here. If you want to get involved, click one of these buttons!

- 11.4K All Categories
- 4.8K Features Discussion
- 293 Downloading Imagery
- 1.1K Elevation Data
- 361 Georeferencing Imagery Discussion
- 507 GM Script Language
- 35 User Scripts
- 106 GPS Features
- 348 Projection Questions
- 733 Raster Data
- 1.2K Vector Data
- 6.1K Support
- 151 Announcement and News
- 822 Bug Report
- 548 SDK
- 1.1K Suggestion Box
- 3.5K Technical Support
- 458 Other Discussion
- 112 GIS Data Sources
- 25 Global Mapper Showcase
- 191 How I use Global Mapper
- 89 Global Mapper Forum Website

## Comments

17,238It sounds like what you might be after are ECEF (earth-centered earth-fixed) coordinates for a lat/lon location. Currently you can get ECEF coordinates out when exporting to a DXF format file. There is not currently any other way to convert your lat/lon values to a ECEF value based on the current ellipsoid.

Since you sound like developers, I can provide you our source code that converts a lat/lon value to ECEF coordinates based on an ellipsoid. The formulas are very simple.

//*********************************************************************

//

// METHOD NAME:

// DatumConvertor::convertToECEF

//

// DESCRIPTION:

// Converts the given latitude/longitude value (in radians)

// into ECEF (Earth Centered Earth Fixed) coordinates.

//

//********************************************************************/

bool

DatumConvertor::convertToECEF

(

double& aX,

double& aY,

double& aZ,

DATUM aDatum

)

{

// Get the datum parameters

DatumParameters* theDatumParams = getDatumParameters( aDatum );

if ( NULL == theDatumParams )

{

return ( false );

}

// Get the ellipsoid parameters

EllipsoidParameters* theEllipsoidParams =

getEllipsoidParameters( theDatumParams->mEllipsoid );

if ( NULL == theEllipsoidParams )

{

return ( false );

}

// Calculate the sine and cosine of the lat/lon values

double theCosLat = ::cos( aY );

double theCosLon = ::cos( aX );

double theSinLat = ::sin( aY );

double theSinLon = ::sin( aX );

// Calculate the Prime Vertical of Curvature (meters)

double theTemp = 1.0 - theEllipsoidParams->mEccSquared * theSinLat * theSinLat;

if ( theTemp <= 0.0 )

{

return ( false );

}

double thePVC = theEllipsoidParams->mMajorAxis / ::sqrt( theTemp );

// Calculate the ECEF x, y, and z values

aX = ( thePVC + aZ ) * theCosLat * theCosLon;

aY = ( thePVC + aZ ) * theCosLat * theSinLon;

aZ = ( thePVC * ( 1.0 - theEllipsoidParams->mEccSquared ) + aZ ) * theSinLat;

return ( true );

} // end of function DatumConvertor::convertToECEF

Let me know if I can be of further assistance.

Thanks,

Mike

Global Mapper Support

support@globalmapper.com

10Thanks for your reply. I understand what you said but where do I find the DatumParameter and EllipsoidParameter classes, for which you have created instances in the source code that you provided.

Waiting for your reply.

With Best Regards,

Atif

17,238Really all you need is the ellipsoid one, here is its declaration:

// Ellipsoid info type

struct EllipsoidParameters

{

double mMajorAxis; // Major axis in meters

double mMinorAxis; // Minor axis in meters

double mDeltaA; // Equatorial radius shift from WGS84

double mDeltaF; // Flattening shift from WGS84

double mFlattening; // Ellipsoid flattening

double mEccSquared; // Eccentricity squared

double mEcc2Squared; // Secondary eccentricity squared

};

You would just use the semi-major axis of your ellipsoid and the eccentricity squared value for the ellipsoid in the formula. You would likely use the WGS84 values in your application unless you needed another ellipsoid for some reason.

Thanks,

Mike

Global Mapper Support

support@globalmapper.com