h-geo: Difference between revisions
(→Status: -mailinglist) |
GRegorLove (talk | contribs) m (s/<source>/<syntaxhighlight>/) |
||
(5 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
<dfn style="font-style:normal;font-weight:bold">h-geo</dfn> is a simple, open format for publishing [http://en.wikipedia.org/wiki/WGS84 WGS84] geographic coordinates. h-geo is one of several open [[microformats|microformat]] draft standards suitable for embedding data in HTML. | |||
<dfn style="font-style:normal;font-weight:bold">h-geo</dfn> is a simple, open format for publishing [http://en.wikipedia.org/wiki/WGS84 WGS84] geographic coordinates. h-geo is one of several open [[microformats|microformat]] draft standards suitable for embedding data in HTML | |||
h-geo is the [[microformats2]] update to [[geo]]. It is most commonly used as part of an [[h-card]] or [[h-event]]. | h-geo is the [[microformats2]] update to [[geo]]. It is most commonly used as part of an [[h-card]] or [[h-event]]. | ||
{{cc0-owfa-license}} | ;<span id="Status">Status</span> | ||
:This is a '''Draft Specification''' | |||
;Participate | |||
:[[IRC]]: [irc://irc.libera.chat/microformats #microformats on Libera] | |||
;Editor | |||
:<span class="h-card vcard"><span class="p-name fn">[[User:Tantek|Tantek Çelik]]</span> (<span class="p-role role">Editor</span>)</span> | |||
;License | |||
:{{cc0-owfa-license}} | |||
__TOC__ | |||
== Example == | == Example == | ||
Here is a simple h-geo example: | Here is a simple h-geo example: | ||
< | <syntaxhighlight lang="html"> | ||
<p class="h-geo"> | <p class="h-geo"> | ||
<span class="p-latitude">-27.116667</span>, | <span class="p-latitude">-27.116667</span>, | ||
<span class="p-longitude">-109.366667</span> | <span class="p-longitude">-109.366667</span> | ||
</p> | </p> | ||
</ | </syntaxhighlight> | ||
Parsed JSON: | Parsed JSON: | ||
< | <syntaxhighlight lang="json"> | ||
{ | { | ||
"items": [ | "items": [ | ||
Line 40: | Line 45: | ||
] | ] | ||
} | } | ||
</ | </syntaxhighlight> | ||
=== Get started === | === Get started === | ||
Line 59: | Line 64: | ||
== Status == | == Status == | ||
'''h-geo''' is a microformats.org draft specification. Public discussion on h-geo takes place on [[h-geo-feedback]] and the #microformats [[irc]] channel on | '''h-geo''' is a microformats.org draft specification. Public discussion on h-geo takes place on [[h-geo-feedback]] and the #microformats [[irc]] channel on libera.chat. | ||
h-geo is ready to use and implemented in the wild, but for backwards compatibility you should also mark h-geos up with classic [[geo]] classnames. | h-geo is ready to use and implemented in the wild, but for backwards compatibility you should also mark h-geos up with classic [[geo]] classnames. | ||
Line 65: | Line 70: | ||
== Property Details == | == Property Details == | ||
'''p-altitude''' refers to the distance in metres from the nominal sea level along the tangent of the earth’s curve. For more information refer to the [http://en.wikipedia.org/wiki/WGS84 WGS84] specification. | '''p-altitude''' refers to the distance in metres from the nominal sea level along the tangent of the earth’s curve, i.e. the geoid height. For more information refer to the [http://en.wikipedia.org/wiki/WGS84 WGS84] specification and the [https://en.wikipedia.org/wiki/Geo_URI_scheme geo URI scheme]. | ||
== FAQ == | == FAQ == | ||
Line 75: | Line 80: | ||
You could present the coordinates in a more human-readable form, retaining the decimal coordinates inside data value attributes: | You could present the coordinates in a more human-readable form, retaining the decimal coordinates inside data value attributes: | ||
< | <syntaxhighlight lang="html"> | ||
<p class="h-geo"> | <p class="h-geo"> | ||
<data class="p-longitude" value="-27.116667">27° 7′ 0″ S</data>, | <data class="p-longitude" value="-27.116667">27° 7′ 0″ S</data>, | ||
<data class="p-latitude" value="-109.366667">109° 22′ 0″ W</data> | <data class="p-latitude" value="-109.366667">109° 22′ 0″ W</data> | ||
</p> | </p> | ||
</ | </syntaxhighlight> | ||
Alternatively you could not show coordinates at all and simply show a human-readable representation of the location, with the lat/long in value attributes of empty data elements. | Alternatively you could not show coordinates at all and simply show a human-readable representation of the location, with the lat/long in value attributes of empty data elements. | ||
Line 94: | Line 99: | ||
For backward compatibility, you may wish to use classic [[geo]] classnames in addition to the more future-proof h-geo properties, for example: | For backward compatibility, you may wish to use classic [[geo]] classnames in addition to the more future-proof h-geo properties, for example: | ||
< | <syntaxhighlight lang="html"> | ||
<p class="h-geo geo"> | <p class="h-geo geo"> | ||
<span class="p-latitude latitude">-27.116667</span>, | <span class="p-latitude latitude">-27.116667</span>, | ||
<span class="p-longitude longitude">-109.366667</span> | <span class="p-longitude longitude">-109.366667</span> | ||
</p> | </p> | ||
</ | </syntaxhighlight> | ||
=== Parser Compatibility === | === Parser Compatibility === |
Latest revision as of 21:21, 26 July 2023
h-geo is a simple, open format for publishing WGS84 geographic coordinates. h-geo is one of several open microformat draft standards suitable for embedding data in HTML.
h-geo is the microformats2 update to geo. It is most commonly used as part of an h-card or h-event.
- Status
- This is a Draft Specification
- Participate
- IRC: #microformats on Libera
- Editor
- Tantek Çelik (Editor)
- License
- Per CC0, to the extent possible under law, the editors have waived all copyright and related or neighboring rights to this work. In addition, as of 2024-12-01, the editors have made this specification available under the Open Web Foundation Agreement Version 1.0.
Example
Here is a simple h-geo example:
<p class="h-geo">
<span class="p-latitude">-27.116667</span>,
<span class="p-longitude">-109.366667</span>
</p>
Parsed JSON:
{
"items": [
{
"type": [
"h-geo"
],
"properties": {
"latitude": [
"-27.116667"
],
"longitude": [
"-109.366667"
],
"name": [
"-27.116667, -109.366667"
]
}
}
]
}
Get started
The class h-geo
is a root class name that indicates the presence of an h-geo.
p-latitude, p-longitude and p-altitude classnames define an element as a property of the h-geo.
See microformats2-parsing to learn more about property classnames.
Properties
h-geo properties, inside an element with class h-geo:
p-latitude
- decimal latitudep-longitude
- decimal longitudep-altitude
- decimal altitude
All properties are optional.
Status
h-geo is a microformats.org draft specification. Public discussion on h-geo takes place on h-geo-feedback and the #microformats irc channel on libera.chat.
h-geo is ready to use and implemented in the wild, but for backwards compatibility you should also mark h-geos up with classic geo classnames.
Property Details
p-altitude refers to the distance in metres from the nominal sea level along the tangent of the earth’s curve, i.e. the geoid height. For more information refer to the WGS84 specification and the geo URI scheme.
FAQ
How should I mark up lat/long coordinates without them looking messy and confusing?
Unless your content is targeted at an audience with a high leg authoring p-latitude and p-longitude as plain numbers on a webpage may not be the best approach. In addition to this there may be accessibility issues due to the potentially long strings of numbers being read out.
You could present the coordinates in a more human-readable form, retaining the decimal coordinates inside data value attributes:
<p class="h-geo">
<data class="p-longitude" value="-27.116667">27° 7′ 0″ S</data>,
<data class="p-latitude" value="-109.366667">109° 22′ 0″ W</data>
</p>
Alternatively you could not show coordinates at all and simply show a human-readable representation of the location, with the lat/long in value attributes of empty data elements.
Examples in the Wild
- … add any h-geo examples you find in the wild
Validating
Test and validate microformats2 markup in general with:
- https://pin13.net/mf2/ - enter your markup directly
- https://pin13.net/ - enter a URL to a page to test where it says "Microformats Parser"
Backward Compatibility
Publisher Compatibility
For backward compatibility, you may wish to use classic geo classnames in addition to the more future-proof h-geo properties, for example:
<p class="h-geo geo">
<span class="p-latitude latitude">-27.116667</span>,
<span class="p-longitude longitude">-109.366667</span>
</p>
Parser Compatibility
Microformats parsers SHOULD detect classic properties only if a classic root class name is found and parse them as microformats2 properties.
If an "h-geo" is found, don't look for an "geo" on the same element.
Compatibility root class name: geo
Properties: (parsed as p- plain text unless otherwise specified)
- latitude
- longitude
Background
h-geo is based on the WGS84 standard, as well as existing geo specification, which was extracted from hCard in order to allow it to be used for applications other than contact information.
See Also
- microformats2
- h-card and h-event often contain h-geo
- h-adr is used to mark up human-readable structured addresses