Geographic location is a little more problematic to encode than other data types we’ve looked at for the Almost Universal API. The issue is that standards for adding geographic information are either overly complicated or they encode information in a hard-to-use-from-JSON manner.
Using GeoRSS
GeoRSS provides two ways (well, way more I’m sure) of adding geographic point information to a blog post (which is essentially the same as AUAPI item). From the webpage:
<georss:point>45.256 -71.92</georss:point>
which would be encoded as:
{
"georss:point" : "45.256 -71.92"
}
and
<georss:where>
<gml:Point>
<gml:pos>45.256 -71.92</gml:pos>
</gml:Point>
</georss:where>
which would be encoded as:
{
"georss:where" : {
"gml:Point" : {
"gml:pos" : "45.256 -71.92",
}
}
}
Neither of these look particularly satisfying because the lat/lon is encoded as a string. We could encode as an array of numbers, but then we have to write a custom transcriber for converting to XML.
Using hCard
Another option would be to use the geo.latitude, geo.longitude attributes in hCard. Unfortunately, hCard requires elements such as FN and in general imply that we are talking about a person or organization, so this isn’t really satisfying either.
How AUAPI recommends geographic information should be encoded
'geo': {
'latitude': 34.743763,
'longitude': -86.572568
}
This in fact, is exactly the microformat’s geo standard.