Difference between revisions of "h-geo"

From Microformats Wiki
Jump to navigation Jump to search
m (→‎See Also: added h-adr)
Line 93: Line 93:
* [[microformats2]]
* [[microformats2]]
* [[h-card]] and [[h-event]] often contain h-geo
* [[h-card]] and [[h-event]] often contain h-geo
* [[h-adr]] is used to mark up human-readable addresses
[[Category:Draft Specifications]]
[[Category:Draft Specifications]]

Revision as of 23:59, 7 July 2013

<entry-title>h-geo</entry-title> Tantek Çelik (Editor)

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/HTML5.

h-geo is the microformats2 update to Geo. It is most commonly used as part of an h-card or h-event.


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>

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 specification to learn more about property classnames.


h-geo properties, inside an element with class h-geo:

  • p-latitude - decimal latitude
  • p-longitude - decimal longitude
  • p-altitude - decimal altitude

All properties are optional.


h-geo is a microformats.org draft specification. Public discussion on h-geo takes place on h-geo-feedback, the #microformats #microformats chat channel on irc.freenode.net, and microformats-new mailing list.

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. For more information refer to the WGS84 specification.


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>

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

Main article: microformats validators

Test and validate microformats2 markup in general with:

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>

Parser Compatibility

Microformats parsers should detect classic properties 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


h-geo is based on the WGS84 standard, as well as existing Geo specification, which was extracted from hCard 1.0 in order to allow it to be used for applications other than contact information.

See Also