Skip to main content

Hello.

This might be a strange question since it does not take into account the Earth. Also, I am quite new to this topic but I did research. I found a lot of things but I never got the result I wanted from various calculators and doing it manually is hard since I am not that familliar with this math.

I was wondering, is there some way to calculate XYZ -> degrees for other bodies with different radius?

For example, this is one of solved:

Planet Radius: 2094km, Earth Masses: 0.0541, X: -1786579.7, Y: 519690.56, Z: -959322.31

This equals: Latitude: 9.2921 and Longitude: -153.9814. I figured that Y and Z are Lat\\Long.

I have no idea how to get this result. Ive tried various calculators like: https://beta.ngs.noaa.gov/gtkweb/ but I just cannot get the correct numbers.

If anyone can offer any insight into this issue I would be very grateful.

Thank you.

 

Hi @robertk,

According to Stack Overflow (https://stackoverflow.com/questions/1185408/converting-from-longitude-latitude-to-cartesian-coordinates), the formula for calculating the spherical lat, long from what appears to be geocentric coordinates would be:

latitude = asin(Z / Radius)

longitude = atan2(Y, X)

However this formula is dependent on these condition:

  • the x-axis goes through long,lat (0,0), so longitude 0 meets the equator;
  • the y-axis goes through (0,90);
  • and the z-axis goes through the poles.

This formula gives us latitude -27.26644670517016, longitude 2.858518396400994, which is quite different from your target lat/long, so it appears that those coordinates are not geocentric.

Are you able to provide any information on the source of the coordinates?


I know Global Mapper comes with a number of ellipsoids for celestial bodies (moon, all major planets, a few dwarf planets and moons). If I understand this correctly that's all you need really.

You could hack your own of course and import them into FME.


I know Global Mapper comes with a number of ellipsoids for celestial bodies (moon, all major planets, a few dwarf planets and moons). If I understand this correctly that's all you need really.

You could hack your own of course and import them into FME.

I just downloaded the evaluation version and it is quite robust. But when I tried to download data I cannot see anything except places on Earth. Unless I am missing something in the normal UI.

 

 


I just downloaded the evaluation version and it is quite robust. But when I tried to download data I cannot see anything except places on Earth. Unless I am missing something in the normal UI.

 

 

I don't think it comes with extraterrestrial data, but you could try NASA.

 

 


I don't think it comes with extraterrestrial data, but you could try NASA.

 

 

 

Ok thanks, will check it out and let you know.

 


 

Ok thanks, will check it out and let you know.

 

Try this one :https://astrogeology.usgs.gov/facilities/mrctr-gis-lab, USGS rather than NASA but it has a lot of good stuff.

 

 


Could you recommend any based on my criteria? tho it can be close. Thanks

 

 


 

Ok thanks, will check it out and let you know.

 

Could you recommend any based on my criteria? tho it can be close. Thanks

 

 


Could you recommend any based on my criteria? tho it can be close. Thanks

 

 

Mercury is close: 2400-ish km radius and 0.05 Earth masses. Callisto (one of Jupiter's moons) is has a similar radius but is much lighter, Io is a bit smaller and again much lighter. (although to be honest, I think radius is much more important for the coordinate system than mass).

 

 

But I'm not a planetary scientist 🙂

 

 

The bigger issue here is that in order to calculate that XYZ you'll also need to know what projection/coordinate system is used.

 

 


Hello! @DaveAtSafe

Thanks for your reply!

I am on a verge of giving up because a lot of time has passed and still no real headway. Its for bonus points but I think its just too hard.

I have read that article and tried to make a C program but it failed. I usually try to exhaust all options I can find before asking. Learned a lot that way but still no closer in solving this...

Also I believe coordinates have Haversine component.

This is a software at university which is closed source. Software is used to do a lot of space calculations for Solar system but it has some addons for others. It is basically a simulator for other worlds and small bodies. Some are real (our system) and most are semi (what is known) and many are not real for practice. Navigation (1st person "hovering") is done by using this format. We are tasked to try and make several waypoints by reading XYZ and then convert them to decimal for easier navigation since every other body will be different and reading XYZ is not really good.

There are several coordinates like this one on the same body as well as few others for reference (solved) to help with the possible solutions for this and eventually some other body with different radius.

Here is another one: Radius: 2503km, EMasses: 0.0503

X: -2405525.88 Y: 490527.71 Z: 483042.96 == Latitude(Y): 11.2058, Longitude(Z): 168.5456

Also I must point out that I saw in UI something that is called "RelativePosition". Then values are (from above): X: -240.5525, Y: 490.527, Z: 483.042

Could it have something with radians? This is a snippet of small program I wrote for known coordinates for calculating area size on particular body. It yields precise results.

#define ONEDEGREEINRADIANS 0.0174532925

double degToRad(double degrees);

int main()
{

double interval, radius, latitude, instance;

// bunch asking for coords and some math stuff

interval = 360 / ((cos(degToRad(latitude)) * (radius * 2 * PI)) / instance);

}

double degToRad(double degrees)

{
return ONEDEGREEINRADIANS * degrees;
}

Thanks.


Hello! @DaveAtSafe

Thanks for your reply!

I am on a verge of giving up because a lot of time has passed and still no real headway. Its for bonus points but I think its just too hard.

I have read that article and tried to make a C program but it failed. I usually try to exhaust all options I can find before asking. Learned a lot that way but still no closer in solving this...

Also I believe coordinates have Haversine component.

This is a software at university which is closed source. Software is used to do a lot of space calculations for Solar system but it has some addons for others. It is basically a simulator for other worlds and small bodies. Some are real (our system) and most are semi (what is known) and many are not real for practice. Navigation (1st person "hovering") is done by using this format. We are tasked to try and make several waypoints by reading XYZ and then convert them to decimal for easier navigation since every other body will be different and reading XYZ is not really good.

There are several coordinates like this one on the same body as well as few others for reference (solved) to help with the possible solutions for this and eventually some other body with different radius.

Here is another one: Radius: 2503km, EMasses: 0.0503

X: -2405525.88 Y: 490527.71 Z: 483042.96 == Latitude(Y): 11.2058, Longitude(Z): 168.5456

Also I must point out that I saw in UI something that is called "RelativePosition". Then values are (from above): X: -240.5525, Y: 490.527, Z: 483.042

Could it have something with radians? This is a snippet of small program I wrote for known coordinates for calculating area size on particular body. It yields precise results.

#define ONEDEGREEINRADIANS 0.0174532925

double degToRad(double degrees);

int main()
{

double interval, radius, latitude, instance;

// bunch asking for coords and some math stuff

interval = 360 / ((cos(degToRad(latitude)) * (radius * 2 * PI)) / instance);

}

double degToRad(double degrees)

{
return ONEDEGREEINRADIANS * degrees;
}

Thanks.

Hi, @robertk

 

The second example fits the formula much better. The results will be in radians, which must converted to degrees. I just multiply by 180/pi.

 

The Haversine formula will give you the distance between two lat/lon locations, but I don't think that helps us here.

 

Are the XYZ values centered on the planet, or are they universal for the entire system?

 

 


Hi, @robertk

 

The second example fits the formula much better. The results will be in radians, which must converted to degrees. I just multiply by 180/pi.

 

The Haversine formula will give you the distance between two lat/lon locations, but I don't think that helps us here.

 

Are the XYZ values centered on the planet, or are they universal for the entire system?

 

 

Hi @DaveAtSafe

 

XYZ
values are centered on the single body. If you go to another you will
get new ones. I am presumming it is because of different radiuses. That
is why I think Radius (maybe EarthMasses) is key to unlocking this.

 

I am just not sure what is the "key" here...

 

 

 


Hi, @robertk

 

The second example fits the formula much better. The results will be in radians, which must converted to degrees. I just multiply by 180/pi.

 

The Haversine formula will give you the distance between two lat/lon locations, but I don't think that helps us here.

 

Are the XYZ values centered on the planet, or are they universal for the entire system?

 

 

@DaveAtSafe

 

You say that this fits the formula. Did you manage to get the correct (or at least near...) Lat\\Long from the example(s)?

 


@DaveAtSafe 

 

You say that this fits the formula. Did you manage to get the correct (or at least near...) Lat\Long from the example(s)? 

 

@robertk,

 

Yes, I got a latitude of 11.127 and a longitude of 168.474, from:

 

latitude = @Evaluate(@asin(@Value(z)/@Value(r))*(180/@pi())) longitude = @Evaluate(@atan2(@Value(y),@Value(x))*(180/@pi()))
where:

 

x = -2405525.88

 

y = 490527.71

 

z = 483042.96

 

r = 2503000

 

 


@robertk,

 

Yes, I got a latitude of 11.127 and a longitude of 168.474, from:

 

latitude = @Evaluate(@asin(@Value(z)/@Value(r))*(180/@pi())) longitude = @Evaluate(@atan2(@Value(y),@Value(x))*(180/@pi()))
where:

 

x = -2405525.88

 

y = 490527.71

 

z = 483042.96

 

r = 2503000

 

 

@DaveAtSafe

 

Oh my God! It works! I tried on several examples and it returns good values! You are the BEST!

 

 

I cannot believe how long it took me to get this right. Wish I could thank you somehow!

 

 

Thanks!

Reply