# Latitude Longtitude to X, Y, Z coordinate system using python

does anyone know how to go about converting lat, long, alt to x, y, z where you have an origin for x/y coordinate (specific place in London)? In other words, I have a lat long and alt data and would like to convert the to x,y,z with respect to a specific place, not the Earth center.

For example, lat long is (51.5081° N, 0.0759° W) tower of london with altitude 100 meters and I want to convert my gps lat long to x y z considering the tower of london as the origin.

• What are the directions of X,Y and Z? – BradHards Jun 26 '17 at 2:57
• i am not sure, sorry only just started playing with geo data. how do you check it? – big_data Jun 26 '17 at 11:28

Assuming you know how to convert lat/lon to earth-centered xyz (for which there are many posts), and assuming your "Tower of London" coordinate system is just a translation of the earth-centered system (ie, your axes are parallel to the corresponding earth-centered axes and oriented in the same directions):

convert the Tower of London lat, lon to xyzTOL

convert the Point of Interest lat, long to xyzPOI

The POI in terms of the Tower of London centered coordinates is:

xyzPOI - xyzTOL

You can set up a local transverse or oblique mercator projection on your origin point using its lon/lat, like described in Using customized Coordinate System in ArcGIS Desktop? In most cases you don't need a rotated CRS, so transverse mercator will do.

If you add the altitude as the `z` coordinate, you will get the altitude in the transformed system in pyproj with transform. You need to subtract the 100m of your origin point.

• thanks! i got the customized coordinate system working and get the same results as whoi.edu/marine/ndsf/cgi-bin/…. Not sure how I can include the altitude tho – big_data Jun 27 '17 at 19:30
• GPS measures height above the geoid. Altitude can be above mean sea level, or above ground. Neither is included in the reprojection formulas. – AndreJ Jun 28 '17 at 5:37