<p>Sure you can! <a href="https://en.wikipedia.org/wiki/Galactic_coordinate_system" rel="noreferrer">Galactic coordinates</a> have the same origin as other J2000.0 systems; the solar system barycenter (center of mass). This is very close to the Sun, usually but not always inside the Sun, because the larger planets, especially Jupiter, pull it around a little bit. You can read a little more <a href="http://astronomy.swin.edu.au/cosmos/G/Galactic+Coordinate+System" rel="noreferrer">here</a> for example, and also read <a href="https://astronomy.stackexchange.com/a/16340/7982">@zephyr's excellent answer</a>.</p>

<p>At first you might ask why the origin of the galactic coordinates isn't the center of the galaxy. I'm pretty sure that the answer is that <em>we don't know where that is!</em> We'd have to know the masses and locations of everything, and of course since most of the galaxy's mass is <a href="https://en.wikipedia.org/wiki/Dark_matter" rel="noreferrer">dark matter</a> we're not going to know where the center of mass is any time soon.</p>

<p>However, the XY plane of the galactic coordinates has been chosen for now, based on an estimate of the Galaxy's apparent equator. Since it's a different plane than our solar system's plane, otherwise known as the ecliptic, the coordinates will be different even though the origin is the same.</p>

<p><a href="https://i.sstatic.net/cW0Dv.jpg" rel="noreferrer"><img src="https://i.sstatic.net/cW0Dv.jpg" alt="enter image description here"></a></p>

<p>Since galactic coordinates are centered near the Sun, the distance of our position from the origin will still be about 1 AU (150,000,000 km).</p>

<p>Below I wrote a little script in Python using the easy-to-use <a href="https://en.wikipedia.org/wiki/Dark_matter" rel="noreferrer">Skyfield</a> python package. At the moment that I've run the program , the coordinates are:</p>

<pre><code>time (JD):   2458099.18846
time (UTC):  (2017, 12, 11, 16, 31, 23.049599826335907)
latitude (degs):    41.42
longitude (degs):   2.15
galactic (km):     [ -1.46347711e+08  -2.89156773e+06  -2.34254700e+07]
barycentric (km):  [  2.69276456e+07   1.33751808e+08   5.79665590e+07]
and just for fun...
galactic latlon (degs):  [-9.0922867698877123, 181.13191434418721]
</code></pre>

<p>Here is the Python script:</p>

<pre><code>import numpy as np
import matplotlib.pyplot as plt
from skyfield.api import Loader, Topos

load    = Loader('~/Documents/SkyData')
planets = load('de421.bsp')
earth, sun = planets['earth'], planets['sun']

ts = load.timescale()
tnow    = ts.now()
tmonth = ts.utc(2017, 12, range(1,31))
topo = Topos(latitude_degrees=41.42, longitude_degrees=2.15)

position = earth + topo

print "time (JD):  ", tnow.tt
print "time (UTC): ", tnow.tt_calendar()
print "latitude (degs):   ", topo.latitude.degrees
print "longitude (degs):  ", topo.longitude.degrees
print "galactic (km):    ", position.at(tnow).galactic_position().km
print "barycentric (km): ", position.at(tnow).position.km
print "and just for fun..."
print "galactic latlon (degs): ", [x.degrees for x in position.at(tnow).galactic_latlon()[:2]]
</code></pre>

CC BY-SA 3.0
2017-12-11T16:23:39.367Z
awesome @uhoh i already had the feeling it was possible!
FutureCake
CC BY-SA 3.0
2017-12-11T16:31:38.073Z
@FutureCake anything is possible with Python :-) But remember that since the Earth is moving in the solar system as well as rotating, these are constantly changing. There aren't fixed coordinates.
uhoh
CC BY-SA 3.0
2017-12-11T17:23:38.617Z
Are you saying that the galactic coordinate system is centered on the Sun, and so the position of the Earth relative to the Sun can be expressed in galactic coordinates? (This would be similar to heliocentric latitude and longitude used to calculate the positions of the planets, from which the Earth-centered right ascension and declination can be calculated.) I think the galactic coordinate system is centered on the Earth just like right ascension and dec (maybe parallax is ignored). So giving the galactic coordinates of (lat, long) is as useful as giving R.A. and dec of (lat, long).
JohnHoltz
CC BY-SA 3.0
2017-12-11T17:47:53.573Z
@JohnHoltz one needs to be careful not to mix purely *apparent angular* 2D coordinates for real 3D cartesian coordinates. Angular coordinates may be calculated for any observer location. For example if you calculate the *apparent RA and Dec* of the Moon from two different places on the Earth and from a satellite in orbit, you'll definitely get three totally different sets of values, but that doesn't mean any of them are wrong. That's an extreme example of your "maybe parallax is ignored". The only useful working origin in Astronomy these days is the barycenter of the solar system.
uhoh
CC BY-SA 3.0
2017-12-12T00:47:27.590Z
Like other people, I am trying to understand the usefulness of knowing the barycentric coordinates from the Sun, in a galactic coordinate system, of a spot on the Earth's surface. Only @FutureCake can answer that question, and does it need to be to the precision of a location on the Earth compared to the center of the Earth or the barycenter of the Earth+Moon system.
JohnHoltz
CC BY-SA 3.0
2017-12-12T01:18:50.043Z
@JohnHoltz You've got it wrong; barycentric coordinates are not measured "from the Sun". They are measured from the solar system barycenter. In stackexchange it is not necessary for one to demonstrate to every other SE user's satisfaction the usefulness of something in order to ask about it. I will say that it is extremely important in Astronomy for there to be a clear understanding of the definitions of *all coordinate systems* and transforms between them. Instead of commenting "I don't know why someone wants to know this", consider asking a new question about coordinate systems.
uhoh
CC BY-SA 4.0
2020-02-15T09:27:53.997Z
I don't understand this at all. The OP clearly has deep misconceptions about longitude and latitude (on Earth) as opposed the Galactic longitude and latitude that give the 2D position of something in the sky. As such this answer is just adding to the general confusion. A position on the Earth does not correspond to anything in Galactic longitude and latitude. If the OP had added a time to the GPS coordinates, you might have had a point.
ProfRob
CC BY-SA 4.0
2020-02-16T00:37:03.207Z
@RobJeffries I'll edit today, thanks! The script uses `.now()` for time but you are right I didn't say that explicitly. I probably felt that the OP's activity in Stack Overflow suggested that they'd catch it, but an answer should be complete for all future readers as well and I didn't explain this yet.
uhoh
CC BY-SA 3.0
2017-12-11T16:16:08.113Z
2017-12-11T18:43:04.470Z
2017-12-11T18:43:04.470Z
uhoh
<p>I am a complete newbie to astronomy and all the related.<br>
So if i say something stupid i am sorry. </p>

<p>But i was wondering if it is possible to translate GPS coordinates like the following: </p>

<pre><code>lat: 41.420042122273024 
long: 2.1533203149999736 
</code></pre>

<p>to its corresponding Galactic coordinates?</p>

<p>I am grateful for all insights that you may offer me :)</p>

<p><strong>PS</strong>: if this is the wrong exchange to ask this could you refer me to the right place to ask this question. </p>

CC BY-SA 3.0
2017-12-11T14:44:16.480Z
Galactic coordinates tell you the location of an object within our galaxy using our galaxy as a reference frame (see [this question/answer](https://astronomy.stackexchange.com/questions/16339/what-is-the-galactic-latitude-and-galactic-longitude-how-is-different-from-the/16340#16340) for example). This has no relation to GPS coordinate systems and there is no way to convert between the two.
zephyr
CC BY-SA 3.0
2017-12-11T16:26:53.140Z
@zephyr can you double check my answer? It looks like there is in fact a convention for doing this.
uhoh
CC BY-SA 3.0
2017-12-11T20:45:25.240Z
@uhoh Okay, you're right. Technically you can convert between any two astronomical coordinate systems so my statement is wrong. But really, the two systems are so disparate, I'm not sure its meaningful or necessary to do so.
zephyr
CC BY-SA 3.0
2017-12-12T01:07:41.220Z
@zephyr I've just asked [How was the galactic plane established, quantitatively and procedurally?](https://astronomy.stackexchange.com/q/23927/7982) I'm not sure it's worded in the best way, you're welcome to edit the question to improve continuity with a good answer.
uhoh
<galaxy><coordinate>
Can you translate a GPS coordinate to a Galactic coordinate?
FutureCake
# Can you translate a GPS coordinate to a Galactic coordinate?

(Asked by: username_0 on 2017-12-11)

I am a complete newbie to astronomy and all the related.
So if i say something stupid i am sorry. 
But i was wondering if it is possible to translate GPS coordinates like the following: 
lat: 41.420042122273024 
long: 2.1533203149999736 

to its corresponding Galactic coordinates?
I am grateful for all insights that you may offer me :)
PS: if this is the wrong exchange to ask this could you refer me to the right place to ask this question.

**Tags:** galaxy, coordinate
> **Comments:**
> **username_1**: Galactic coordinates tell you the location of an object within our galaxy using our galaxy as a reference frame (see [this question/answer](https://astronomy.stackexchange.com/questions/16339/what-is-the-galactic-latitude-and-galactic-longitude-how-is-different-from-the/16340#16340) for example). This has no relation to GPS coordinate systems and there is no way to convert between the two.  
> **username_2**: @zephyr can you double check my answer? It looks like there is in fact a convention for doing this.  
> **username_1**: @uhoh Okay, you're right. Technically you can convert between any two astronomical coordinate systems so my statement is wrong. But really, the two systems are so disparate, I'm not sure its meaningful or necessary to do so.  
> **username_2**: @zephyr I've just asked [How was the galactic plane established, quantitatively and procedurally?](https://astronomy.stackexchange.com/q/23927/7982) I'm not sure it's worded in the best way, you're welcome to edit the question to improve continuity with a good answer.  

---

## 1 answers

### Answer by username_2 on 2017-12-11. Score: 6 | Accepted answer

Sure you can! Galactic coordinates have the same origin as other J2000.0 systems; the solar system barycenter (center of mass). This is very close to the Sun, usually but not always inside the Sun, because the larger planets, especially Jupiter, pull it around a little bit. You can read a little more here for example, and also read @zephyr's excellent answer.
At first you might ask why the origin of the galactic coordinates isn't the center of the galaxy. I'm pretty sure that the answer is that we don't know where that is! We'd have to know the masses and locations of everything, and of course since most of the galaxy's mass is dark matter we're not going to know where the center of mass is any time soon.
However, the XY plane of the galactic coordinates has been chosen for now, based on an estimate of the Galaxy's apparent equator. Since it's a different plane than our solar system's plane, otherwise known as the ecliptic, the coordinates will be different even though the origin is the same.

Since galactic coordinates are centered near the Sun, the distance of our position from the origin will still be about 1 AU (150,000,000 km).
Below I wrote a little script in Python using the easy-to-use Skyfield python package. At the moment that I've run the program , the coordinates are:
time (JD):   2458099.18846
time (UTC):  (2017, 12, 11, 16, 31, 23.049599826335907)
latitude (degs):    41.42
longitude (degs):   2.15
galactic (km):     [ -1.46347711e+08  -2.89156773e+06  -2.34254700e+07]
barycentric (km):  [  2.69276456e+07   1.33751808e+08   5.79665590e+07]
and just for fun...
galactic latlon (degs):  [-9.0922867698877123, 181.13191434418721]

Here is the Python script:
import numpy as np
import matplotlib.pyplot as plt
from skyfield.api import Loader, Topos

load    = Loader('~/Documents/SkyData')
planets = load('de421.bsp')
earth, sun = planets['earth'], planets['sun']

ts = load.timescale()
tnow    = ts.now()
tmonth = ts.utc(2017, 12, range(1,31))
topo = Topos(latitude_degrees=41.42, longitude_degrees=2.15)

position = earth + topo

print "time (JD):  ", tnow.tt
print "time (UTC): ", tnow.tt_calendar()
print "latitude (degs):   ", topo.latitude.degrees
print "longitude (degs):  ", topo.longitude.degrees
print "galactic (km):    ", position.at(tnow).galactic_position().km
print "barycentric (km): ", position.at(tnow).position.km
print "and just for fun..."
print "galactic latlon (degs): ", [x.degrees for x in position.at(tnow).galactic_latlon()[:2]]

> **Comments:**
> **username_0**: awesome @uhoh i already had the feeling it was possible!  
> **username_2**: @FutureCake anything is possible with Python :-) But remember that since the Earth is moving in the solar system as well as rotating, these are constantly changing. There aren't fixed coordinates.  
> **username_3**: Are you saying that the galactic coordinate system is centered on the Sun, and so the position of the Earth relative to the Sun can be expressed in galactic coordinates? (This would be similar to heliocentric latitude and longitude used to calculate the positions of the planets, from which the Earth-centered right ascension and declination can be calculated.) I think the galactic coordinate system is centered on the Earth just like right ascension and dec (maybe parallax is ignored). So giving the galactic coordinates of (lat, long) is as useful as giving R.A. and dec of (lat, long).  
> **username_2**: @JohnHoltz one needs to be careful not to mix purely *apparent angular* 2D coordinates for real 3D cartesian coordinates. Angular coordinates may be calculated for any observer location. For example if you calculate the *apparent RA and Dec* of the Moon from two different places on the Earth and from a satellite in orbit, you'll definitely get three totally different sets of values, but that doesn't mean any of them are wrong. That's an extreme example of your "maybe parallax is ignored". The only useful working origin in Astronomy these days is the barycenter of the solar system.  
> **username_3**: Like other people, I am trying to understand the usefulness of knowing the barycentric coordinates from the Sun, in a galactic coordinate system, of a spot on the Earth's surface. Only @FutureCake can answer that question, and does it need to be to the precision of a location on the Earth compared to the center of the Earth or the barycenter of the Earth+Moon system.  
> **username_2**: @JohnHoltz You've got it wrong; barycentric coordinates are not measured "from the Sun". They are measured from the solar system barycenter. In stackexchange it is not necessary for one to demonstrate to every other SE user's satisfaction the usefulness of something in order to ask about it. I will say that it is extremely important in Astronomy for there to be a clear understanding of the definitions of *all coordinate systems* and transforms between them. Instead of commenting "I don't know why someone wants to know this", consider asking a new question about coordinate systems.  
> **username_4**: I don't understand this at all. The OP clearly has deep misconceptions about longitude and latitude (on Earth) as opposed the Galactic longitude and latitude that give the 2D position of something in the sky. As such this answer is just adding to the general confusion. A position on the Earth does not correspond to anything in Galactic longitude and latitude. If the OP had added a time to the GPS coordinates, you might have had a point.  
> **username_2**: @RobJeffries I'll edit today, thanks! The script uses `.now()` for time but you are right I didn't say that explicitly. I probably felt that the OP's activity in Stack Overflow suggested that they'd catch it, but an answer should be complete for all future readers as well and I didn't explain this yet.  

---

