Post about GeoRSS on the Moon

This commit is contained in:
~lucidiot 2023-10-31 08:32:38 +01:00
parent 1af1620efa
commit 1c7fde6816
2 changed files with 107 additions and 0 deletions

103
feed.xml
View File

@ -1761,6 +1761,109 @@ because astronomers need coffee to go through the night -->
<georss:relationshipTag>has-nothing-to-do-with</georss:relationshipTag>
<georss:elev>2635</georss:elev>
</item>
<item>
<title>Really Spatial Syndication</title>
<pubDate>Sun, 29 Oct 2023 10:50:02 +0100</pubDate>
<guid isPermaLink="false">georss-srs</guid>
<category domain="https://envs.net/~lucidiot/rsrsss/">Tip</category>
<category domain="https://envs.net/~lucidiot/rsrsss/">Geospatial/GeoRSS</category>
<link></link>
<description><![CDATA[
<p>I have covered nearly everything about GeoRSS, but not exactly everything. I promise, someday Ill be posting about something else, but for today, well have to delve deep into the mess that is geolocation.</p>
<h3>Coordinate systems</h3>
<p>If I ask you to give me something that will precisely point at some place, any place in the world, including the middle of the ocean, youre likely to give me so-called <em>GPS coordinates</em>. Those actually are <a href="https://en.wikipedia.org/wiki/World_Geodetic_System#WGS_84" target="_blank">WGS 84</a> coordinates. They represent a location on Earth, assuming the Earth is a perfect ellipsoid (a sphere, but slightly squished at the poles), whose center is the planets center of mass. But there are a lot of other ways to produce coordinates. Even now that GPS coordinates are ubiquitous, many other systems are still in use, for historic reasons, due to technological constraints, or for an increased precision.</p>
<p>Lets start with a simple one. How do you represent coordinates in three dimensions? We did see earlier that GeoRSS has <code>&lt;georss:elev&gt;</code> to set the elevation in meters, but what if you are trying to represent a line that is sloped? For example, you are making your own Strava and want to show that you went up and down a hill. Your track wont be perfectly at sea level, it will have an altitude that changes with each point. You need some way to include the altitude along with the latitude and longitude. In a geospatial database, the typical GPS coordinate system in use is numbered <a href="https://epsg.io/4326" target="_blank">EPSG:4326</a>; store this number next to your coordinates and the database knows you are speaking in WGS 84. But if you want to add a third coordinate for altitudes, you will have to use a different version of the system numbered <a href="https://epsg.io/4979" target="_blank">EPSG:4979</a>. Its the same as GPS, but theres a third axis for a height, starting from the ellipsoid defined by WGS 84, and measured in meters.</p>
<h3>Going beyond Earth</h3>
<p>Lets go further. With all the hype around a bunch of space agencies trying to build a moon space station and two moon bases and sending rovers and all, we have to start thinking about an equivalent of GPS for other planets, and a way to refer to places on any planet. Fortunately, space agencies have had this problem a long time ago, and they have their solutions.</p>
<p>If you define your own geographic coordinate system, you can make your own ellipsoid to describe the shape of the planet, set the origin point (the 0° north 0° east point), and define how altitudes are expressed if you want to have a third dimension. On top of that, you can define a projection to flatten your planet, but thats a whole another can of worms and I wont deal with that here. You could define a coordinate system for the moon, with an ellipsoid that has the size and shape of the Moon, centered on the Moons center of mass, and define wherever you want your origin point to be. And you can do the same thing for basically anything, assuming you can somehow trick geospatial databases into bending a spheroid hard enough to fit your needs.</p>
<p>And thats what the <abbr title="International Astronomical Union">IAU</abbr> did. Those are the same people who said Pluto isnt a planet, so I dont know if you can really trust them, but I havent seen any other coordinate system for other planets that was in widespread use within the space industry. There are lots of <a href="https://spatialreference.org/ref/iau2000/" target="_blank">coordinate systems and projections for planets and moons</a>, including some for Earth because we clearly needed more. For the Moon, youll have to use <a href="https://spatialreference.org/ref/iau2000/30100/" target="_blank">IAU2000:30100</a>, aka <em>Moon 2000</em>. This doesnt mean the Moon is <abbr title="Year 2000">Y2K</abbr>-ready, it just means this was adopted by the IAU in 2000. Moon 2000 is defined in a geospatial database like so:</p>
<figure>
<pre>GEOGCS["Moon 2000",
DATUM["D_Moon_2000",
SPHEROID["Moon_2000_IAU_IAG", 1737400.0, 0.0]],
PRIMEM["Greenwich", 0],
UNIT["Decimal_Degree", 0.0174532925199433]]</pre>
<figcaption>
<a href="https://en.wikipedia.org/wiki/Well-known_text_representation_of_coordinate_reference_systems" target="_blank">Well-Known Text</a> representation of the Moon 2000 coordinate system
</figcaption>
</figure>
<p>The <code>PRIMEM</code> specifies the primary meridian, at 0°; it is called <em>Greenwich</em> even though it definitely doesnt exist on the Moon, because nobody cares about its name. We also dont specify anywhere what the actual location of the origin point is, because databases dont care about that either. The <code>UNIT</code> specifies that we are using decimal degrees for coordinates, with the long number being the multiplier to convert degrees to radians. Those are almost always present in most coordinate systems.</p>
<p>What matters for the Moon is the <code>SPHEROID</code>, with its two parameters, the semi-major axis and the inverse flattening. A spheroid is just another name for an ellipsoid.</p>
<p>In a sphere, the semi-major axis is the radius. In an ellipsoid, that would be the largest radius, as opposed to the semi-minor axis. The inverse flattening defines how hard you should <em>squish</em> the sphere to get an ellipsoid, so it allows calculating the semi-minor axis. Here, we have <code>1737400</code> as the semi-major axis, which matches the radius of the Moon in meters, and <code>0</code> as the inverse flattening, meaning this is a perfect sphere.</p>
<p>Remember how I mentioned in a previous post that <abbr title="Geography Markup Language">GML</abbr> is designed to represent anything about geospatial data? You can check out the <a href="https://spatialreference.org/ref/iau2000/30100/gml/" target="_blank">GML representation of Moon 2000</a> if you wish to be spooked.</p>
<h3>From the Moon to WGS 84</h3>
<p>So lets say we have some Moon 2000 coordinates, for example <a href="https://en.wikipedia.org/wiki/Tranquility_Base" target="_blank">Tranquility Base</a>, at <a href="https://geohack.toolforge.org/geohack.php?pagename=Tranquility_Base&amp;params=00_41_15_N_23_26_00_E_globe:moon_type:landmark" target="_blank">0.6875°, 23.433333°</a>. How do you put that into GeoRSS?</p>
<p>Since databases dont care one bit whether what you are doing makes any sense, you could convert directly from Moon 2000 to WGS 84. That would make the database assume that your coordinates are just on a very weirdly-shaped Earth. Since coordinates are in degrees, the size of the Earth doesnt matter, and the coordinates will remain unchanged after this conversion; maybe with some slight changes to account for the differently-shaped ellipsoid. You are now in <a href="https://geohack.toolforge.org/geohack.php?pagename=Tranquility_Base&amp;params=00_41_15_N_23_26_00_E_globe:earth_type:landmark" target="_blank">some weird place in Democratic Republic of the Congo</a>.</p>
<p>To do the proper conversion, you will need to do some trigonometry. Your Moon 2000 coordinates and the Moon 2000 spheroid are related to the center of mass of the Moon. WGS 84 is the same for Earth. Knowing the distance between the Earth and the Moons centers of masses, and knowing <a href="https://astronomy.stackexchange.com/a/30434" target="_blank">the position of the Moon on the Earths surface</a> at a given date and time, it should be possible to get the offset in degrees to add to the latitude and longitude to said position to get the position of your target on Earth, as well as the altitude from Earth.</p>
<figure>
<img src="https://envs.net/~lucidiot/rsrsss/img/earth-moon-projection.svg" />
<figcaption>Schematic representation of the geometric shenanigans to get WGS 84 coordinates for Tranquility Base</figcaption>
</figure>
<p>Thats a mess, and you can do something easier than that: just make it someone elses problem. GeoRSS GML lets you set a different coordinate system using the <code>srsName</code> attribute. And if you are using any amount of dimensions other than two, you can use <code>srsDimension</code> as well.</p>
<h3>Examples</h3>
<p>Here is an example of one of the telescopes of the <abbr title="Very Large Telescope">VLT</abbr>, the same that I mentioned in my post about circles in GeoRSS, but using a third dimension in its coordinates instead of the <code>&lt;georss:elev&gt;</code> tag:</p>
<figure>
<pre>&lt;georss:where&gt;
&lt;gml:Point srsName="urn:ogc:def:crs:EPSG:9.0:4979" srsDimension="3"&gt;
&lt;gml:pos&gt;-24.62759969859908 -70.40503541618583 2635&lt;/gml:pos&gt;
&lt;/gml:Point&gt;
&lt;/georss:where&gt;
&lt;georss:featureName&gt;Antu, VLT-UT1&lt;/georss:featureName&gt;
&lt;georss:featureTypeTag&gt;telescope&lt;/georss:featureTypeTag&gt;
&lt;georss:relationshipTag&gt;has-nothing-to-do-with&lt;/georss:relationshipTag&gt;</pre>
<figcaption>Getting a third dimension in GeoRSS GML</figcaption>
</figure>
<p>To specify that I am using <a href="https://epsg.io/4979" target="_blank">EPSG:4979</a>, I am using the <code>srsName</code> attribute with a <abbr title="Uniform Resource Name">URN</abbr>, specifically an <a href="https://www.ogc.org/about-ogc/policies/ogc-urn-policy/" target="_blank"><abbr title="Open Geospatial Consortium">OGC</abbr> URN</a>, which defined that <code>def:crs:</code> defines a coordinate reference system. <code>EPSG</code> says the authority defining this system is the <abbr title="European Petroleum Survey Group">EPSG</abbr>, <code>9.0</code> is the version number of their <a href="https://en.wikipedia.org/wiki/EPSG_Geodetic_Parameter_Dataset" target="_blank">Geodetic Parameter database</a>, and <code>4979</code> is the identifier of the system within that database.</p>
<p>I am also using <code>srsDimension</code>, which allows specifying how many dimensions the coordinate system has. While this could be guessed from the coordinate system, this allows feed parsers and validators to know that they should expect coordinates of this amount of dimensions without having to know about coordinate systems, which can simplify implementations. Perhaps you can just send the <code>srsName</code> verbatim to some other software library specialized in coordinate systems.</p>
<p>And here is Tranquility Base! Since the <code>IAU2000</code> coordinate systems and projections do not have a <abbr title="Uniform Resource Name">URN</abbr>, I am instead using a <abbr title="Uniform Resource Locator">URL</abbr> to the GML definition of the coordinate system I want.</p>
<figure>
<pre>&lt;georss:where&gt;
&lt;gml:Point srsName="https://spatialreference.org/ref/iau2000/30100/gml/"&gt;
&lt;gml:pos&gt;0.6875 23.433333&lt;/gml:pos&gt;
&lt;/gml:Point&gt;
&lt;/georss:where&gt;
&lt;georss:featureName&gt;Tranquility Base&lt;/georss:featureName&gt;
&lt;georss:featureTypeTag&gt;landing-site&lt;/georss:featureTypeTag&gt;
&lt;georss:relationshipTag&gt;used-as-example&lt;/georss:relationshipTag&gt;</pre>
<figcaption>Pointing at Tranquility Base in GeoRSS GML</figcaption>
</figure>
<h3>Reference</h3>
<dl>
<dt><code><dfn>srsName</dfn></code></dt>
<dd>
<p>The spatial reference system used for this geometry. This should be either a <abbr title="Uniform Resource Name">URN</abbr> for a common system, for example <code>urn:ogc:def:crs:EPSG:&lt;version&gt;:&lt;identifier&gt;</code>, where <code>&lt;version&gt;</code> is the version number of the <abbr title="European Petroleum Survey Group">EPSG</abbr> database of spatial reference systems, and <code>&lt;identifier&gt;</code> is the number of the system. For <code>EPSG:4979</code>, you could use <code>urn:ogc:def:crs:EPSG:9.0:4979</code>. For an <abbr title="Spatial Reference System">SRS</abbr> that does not have a URN, or has a custom definition, you can use a <abbr title="Uniform Resource Locator">URL</abbr> that points to the definition of this SRS in GML. For <code>IAU2000:30100</code>, you could use <code>https://spatialreference.org/ref/iau2000/30100/gml/</code>.</p>
<p>The <a href="https://validator.w3.org/feed/" target="_blank">W3C Feed Validation Service</a> allows this attribute, but does not perform any validation on its value.</p>
</dd>
<dt><code><dfn>srsDimension</dfn></code></dt>
<dd>
<p>The number of dimensions of this spatial reference system. Since the default is the 2-dimensional WGS 84 (EPSG:4326), you will always need to set <code>srsName</code> along with this. This is always implied by the system you are using, but this makes it easier to validate your data since a GeoRSS validator does not have to know how the <abbr title="Spatial Reference System">SRS</abbr> defined, or understand the concept of SRS, to be able to tell if you put the right amount of coordinates in your data.</p>
<p>You can set both of these attributes on <code>&lt;gml:Point&gt;</code>, <code>&lt;gml:LineString&gt;</code>, <code>&lt;gml:LinearRing&gt;</code>, <code>&lt;gml:Envelope&gt;</code>, <code>&lt;gml:Polygon&gt;</code> or <code>&lt;gml:CircleByCenterPoint&gt;</code>. You can also set these directly on <code>&lt;gml:pos&gt;</code> and <code>&lt;gml:posList&gt;</code>, but the <a href="https://schemas.opengis.net/georss/1.0/schema-1.1/gmlgeorss.xsd" target="_blank"><abbr title="XML Schema Definition">XSD</abbr> for the GeoRSS GML Application Profile</a> says that <cite>"It is expected that this attribute will be specified at the direct position level only in rare cases"</cite>.</p>
<p>While the <a href="https://validator.w3.org/feed/" target="_blank">W3C Feed Validation Service</a> supports this attribute, it only validates that it is a valid positive integer, not that it matches the specified <abbr title="Spatial Reference System">SRS</abbr>, or that the coordinates specified in the geometries match this attribute. It also does not allow this attribute on <code>&lt;gml:pos&gt;</code> or <code>&lt;gml:posList&gt;</code>.</p>
</dd>
</dl>
]]></description>
<georss:where>
<gml:Point srsName="https://spatialreference.org/ref/iau2000/30100/gml/">
<gml:pos>0.6875 23.433333</gml:pos>
</gml:Point>
</georss:where>
<georss:featureName>Tranquility Base</georss:featureName>
<georss:featureTypeTag>landing-site</georss:featureTypeTag>
<georss:relationshipTag>used-as-example</georss:relationshipTag>
</item>
</channel>
<access:restriction relationship="allow" />
</rss>

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60.138 32.088"><defs><path id="g" d="M166.178 197.702h53.213v34.482h-53.213z"/><path id="e" d="M220.448 244.916h116.24v13.761h-116.24z"/><path id="d" d="M266.917 181.54H368.35v34.904H266.917z"/><path id="c" d="M139.376 261.14h80.478v32.229h-80.478z"/><path id="f" d="M220.448 244.916h116.24v13.761h-116.24z"/><marker id="a" markerHeight="1" markerWidth="1" orient="auto" overflow="visible" preserveAspectRatio="xMidYMid" refX="0" refY="0" viewBox="0 0 1 1"><path fill="context-stroke" fill-rule="evenodd" d="M5 0c0 2.76-2.24 5-5 5s-5-2.24-5-5 2.3-5 5-5c2.76 0 5 2.24 5 5z" transform="scale(.5)"/></marker><marker id="b" markerHeight="1" markerWidth="1" orient="auto" overflow="visible" preserveAspectRatio="xMidYMid" refX="0" refY="0" viewBox="0 0 1 1"><path fill="context-stroke" fill-rule="evenodd" d="M5 0c0 2.76-2.24 5-5 5s-5-2.24-5-5 2.3-5 5-5c2.76 0 5 2.24 5 5z" transform="scale(.5)"/></marker></defs><g transform="translate(-35.455 -45.569)"><circle cx="45.849" cy="67.264" r="10.393" fill="#268bd2"/><circle cx="86.807" cy="56.82" r="8.787" fill="#657b83"/><path fill="none" stroke="#000" stroke-width=".265" marker-end="url(#a)" marker-start="url(#b)" d="M45.849 67.264 86.807 56.82"/><path fill="none" stroke="#000" stroke-width=".265" marker-end="url(#a)" marker-start="url(#a)" d="M80.885 50.328 55.275 62.78"/><text xml:space="preserve" x="65.536" font-family="sans-serif" font-size="10.667" font-weight="400" letter-spacing="0" style="line-height:1.25;white-space:pre;shape-inside:url(#c)" transform="translate(64.064 11.013) scale(.16768)" word-spacing="0"><tspan x="139.375" y="270.846">CENTER
</tspan><tspan x="139.375" y="284.179">OF MASS</tspan></text><text xml:space="preserve" font-family="sans-serif" font-size="10.667" font-weight="400" letter-spacing="0" style="line-height:1.25;white-space:pre;shape-inside:url(#d)" transform="translate(19.602 8.386) scale(.20262)" word-spacing="0"><tspan x="266.916" y="191.244">TRANQUILITY
</tspan><tspan x="266.916" y="204.578">BASE</tspan></text><text xml:space="preserve" font-family="sans-serif" font-size="10.667" font-weight="400" letter-spacing="0" style="line-height:1.25;white-space:pre;shape-inside:url(#e)" transform="rotate(-14.626 144.307 -46.558) scale(.15944)" word-spacing="0"><tspan x="220.447" y="254.621">Earth-Moon distance</tspan></text><text xml:space="preserve" font-family="sans-serif" font-size="10.667" font-weight="400" letter-spacing="0" style="line-height:1.25;white-space:pre;shape-inside:url(#f)" transform="rotate(-24.869 87.793 -19.172) scale(.15944)" word-spacing="0"><tspan x="220.447" y="254.621">Altitude</tspan></text><path fill="none" stroke="#000" stroke-dasharray=".264583,.793749" stroke-width=".265" d="m55.275 62.78-9.426 4.484"/><path fill="none" stroke="#000" stroke-dasharray=".264583,.529166" stroke-width=".265" d="m80.885 50.328 5.922 6.492"/><text xml:space="preserve" x="50.432" font-family="sans-serif" font-size="10.667" font-weight="400" letter-spacing="0" style="line-height:1.25;text-align:start;white-space:pre;shape-inside:url(#g)" transform="translate(18.235 26.19) scale(.16514)" word-spacing="0"><tspan x="166.178" y="207.407">EARTH
</tspan><tspan x="166.178" y="220.74">LOCATION</tspan></text><text xml:space="preserve" x="44.689" y="66.931" stroke-width=".192" font-family="sans-serif" font-size="2.05" letter-spacing="0" style="line-height:1.25;text-align:end" text-anchor="end" word-spacing="0"><tspan x="44.689" y="66.931">CENTER</tspan><tspan x="44.689" y="69.492">OF MASS</tspan></text></g></svg>

After

Width:  |  Height:  |  Size: 3.5 KiB