Looping a geoJSON

You are correct - Original code is from here. Taking straight from Stack Overflow - it’s the x, y coordinates for a sphere with three dimensions not a mapping to the surface - oops
A bit more digging and I would update the function as follows

def ll2cc(lat, lon, altitude=0, deg=True):
    
    def rad(d):
        return UnitUtils.Convert(d, UnitTypeId.Degrees, UnitTypeId.Radians)
    
    R = 63710088 # Arithmetic mean radius of Earth in meters
    
    if deg:
        lat, lon = rad(lat), rad(lon)
        
    return XYZ(R * lon * cos(lat), R * lat, altitude)
2 Likes