How to get lat & lon of a point after setting EarthAnchorPoint?

As shown below, I’ve already set Point A as the EarthAnchorPoint by providing its latitude and longitude.

May I ask how to get the latitude and longitude of Point B, knowing its xy coordinates in the current Cartesian coordinate system, using the rhino3dm.py module?

Thanks.

You will need to define a local “2D” coordinate system. Your best bet is to use UTM (Universal Transverse Mercator), which has global coverage and you can easily calculate out which one of its 60 zones your EarthAnchorPoint lies in.

def get_local_UTM(lon, lat):
            epsg = int(32700-round((45+lat)/90)*100+round((183+lon)/6))
            return "EPSG:" + str(epsg)

Once you have the EPSG code of your local coordinate system, you can use a projection library of your choice (PyProj or ProjNet?), or some web-api (epsg.io?), to convert coordinates from LonLat to XY and vice-versa.

Just to clarify, you will need to:

  1. Project EarthAnchorPoint from EPSG:4326 (LonLat) to EPSG:326xx (UTM)
  2. Add your local Rhino XY point coordinates to the XY coordinate from step #1
  3. Project the result from step #2 from EPSG:326xx (UTM) back to EPSG:4326 (LonLat)
1 Like