Difference between revisions of "Wikitravel:Geocoding"
Revision as of 09:52, 6 February 2008
It's possible to encode information about the latitude and longitude of a destination into the destination guide itself. This information will then be used to make special HTML tags to show that the page is related to those lat/long coordinates; some Web spiders and bots use this information to relate a Web page to a geographic location.
For a destination
The easiest way to add lat/long information to a destination guide article is to use the Geo template. To do so, add the following code to a page:
Here, lat is the latitude and long is the longitude. Both coordinates must be in decimal form ("45.5", not "45 30 00") and use negative numbers for south and west ("-73.6", not "73.6W"). For example, Montreal contains the code:
Note that only one instance in a page makes sense.
Behind the scenes, we use RDF to encode lat/long information into pages. It's possible to add the RDF for lat/long info directly, without using a template. For example:
<rdf> <> dcterms:spatial [ pos:lat "45.5" ; pos:long "-73.6" ] . </rdf>
Which means, roughly, "this page covers something with lat/long of 45.5/-73.6".
For a listing item
There's not yet a way to encode GPS information for attractions, restaurants, etc. in Wikitravel.
There's special code on the Wikitravel server to check for this kind of RDF data and to re-encode it in HTML <meta> tags when the page is shown. This is useful for some Web spiders and other tools that require that the meta tags be set. Adding the page to GeoURL, for example, will bring it up on their geographic search engine.
Because this system assigns a single geographic point to the entire destination guide, it's only suited to locations that are a) big enough to have a whole guide to themselves and b) small enough that a single point is a reasonable approximation for the location. This mostly means that only city guides are amenable to geocoding in this way.
We'll soon have a way to assign points to individual listings in a guide using Wikitravel:Listings.
Sources for lat/longs
There are a few Web sites that provide useful lat/long information.