Help Wikitravel grow by contributing to an article! Learn how.

Difference between revisions of "Wikitravel:Geocoding"

From Wikitravel
Jump to: navigation, search
m (Results: geourl submission)
m (attempt fix)
 
(34 intermediate revisions by 17 users not shown)
Line 1: Line 1:
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.
+
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. A "Map" link will also be added to the "Toolbox" in the left pane, which will take users to a Google, Yahoo, or Microsoft map of the location.
  
== Encoding ==
+
== Syntax ==
  
We use [[Wikitravel:RDF|RDF]] to encode lat/long information into pages. The easiest was to add lat/long information to a page is to use the [[:Template:Geo|Geo]] template. To do so, add the following code to a page:
+
===For a destination===
 +
 
 +
The easiest way to add lat/long information to a destination guide article is to use the [[:Template:Geo|Geo]] template. To do so, add the following code to a page:
  
 
  <nowiki>{{Geo|</nowiki>''lat''|''long''<nowiki>}}</nowiki>
 
  <nowiki>{{Geo|</nowiki>''lat''|''long''<nowiki>}}</nowiki>
  
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:
+
Here, ''lat'' is the latitude and ''long'' is the longitude. Both coordinates must be in decimal form ("45.5", not "45 30 00")--see [[#Converting from traditional format|Converting from traditional format]]. For example, [[Montreal]] contains the code:
  
 
  <nowiki>{{Geo|45.5|-73.6}}</nowiki>
 
  <nowiki>{{Geo|45.5|-73.6}}</nowiki>
  
Note that only one instance in a page makes sense. There's not yet a way to encode GPS information for attractions, restaurants, etc. in Wikitravel.
+
Note that only one instance in a page makes sense.
  
It's also possible to add the RDF for lat/long info directly, without using a template. For example:
+
Behind the scenes, we use [[Wikitravel:RDF|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:
  
  <nowiki> <rdf>
+
  &lt;rdf>
 
   <> dcterms:spatial [ pos:lat "45.5" ; pos:long "-73.6" ] .
 
   <> dcterms:spatial [ pos:lat "45.5" ; pos:long "-73.6" ] .
 
  </rdf></nowiki>
 
  </rdf></nowiki>
  
 
Which means, roughly, "this page covers something with lat/long of 45.5/-73.6".
 
Which means, roughly, "this page covers something with lat/long of 45.5/-73.6".
 +
 +
===For a listing item===
 +
 +
To encode GPS information for attractions, restaurants, etc. in Wikitravel, you can use [[Wikitravel:Listings]] ''experimental'' feature: it allows ''lat'' and ''long'' attributes for every listing item.
 +
 +
==Converting from traditional format==
 +
To convert from traditional format like ''lat=N45°30'0"'', ''long=W73°36'0"'', the following can help:
 +
* X°Y'Z" = X+(Y/60)+(Z/3600)
 +
* for S, add "-" to ''lat''; for N, assume "+"
 +
* for W, add "-" to ''long''; for E, assume "+"
  
 
== Results ==
 
== Results ==
Line 29: Line 41:
 
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.
 
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.
  
It's possible in the future that we'll have a way to assign points to individual listings in a guide, or to assign groups of points to define a region or a box.
+
We'll soon have a way to assign points to individual listings in a guide using [[Wikitravel:Listings]].
  
 
== Sources for lat/longs ==
 
== Sources for lat/longs ==
  
There are a few Web sites that provide useful lat/long information.
+
{{sources-lat-long}}
 
+
* [http://www.multimap.com/ Multimap] lets you search for cities in many countries and returns lat/long info
+
* The [http://www.getty.edu/research/conducting_research/vocabularies/tgn/ Getty Thesaurus of Names] has lat/long info for most cities in its database
+
  
 
== External links ==
 
== External links ==
Line 42: Line 51:
 
* http://geourl.org/ -- uses the <meta> tags generated by this system
 
* http://geourl.org/ -- uses the <meta> tags generated by this system
 
* http://geotags.com/ -- another geographical tag browser
 
* http://geotags.com/ -- another geographical tag browser
 +
* http://microformats.org/wiki/geo -- geo microformat
 +
* http://www.geo-tag.de -- generates and validates geo (meta) tags
 +
 +
 +
 +
 +
[[de:Wikitravel:Geocoding]]
 +
[[ja:Wikitravel:ジオコーディング]]
 +
[[sv:Wikitravel:Geokodning]]
 +
 +
 +
 +
{{WikitravelDoc|help}}

Latest revision as of 19:48, 5 December 2011

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. A "Map" link will also be added to the "Toolbox" in the left pane, which will take users to a Google, Yahoo, or Microsoft map of the location.

Contents

Syntax[edit]

For a destination[edit]

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:

{{Geo|lat|long}}

Here, lat is the latitude and long is the longitude. Both coordinates must be in decimal form ("45.5", not "45 30 00")--see Converting from traditional format. For example, Montreal contains the code:

{{Geo|45.5|-73.6}}

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></nowiki>

Which means, roughly, "this page covers something with lat/long of 45.5/-73.6".

For a listing item[edit]

To encode GPS information for attractions, restaurants, etc. in Wikitravel, you can use Wikitravel:Listings experimental feature: it allows lat and long attributes for every listing item.

Converting from traditional format[edit]

To convert from traditional format like lat=N45°30'0", long=W73°36'0", the following can help:

  • X°Y'Z" = X+(Y/60)+(Z/3600)
  • for S, add "-" to lat; for N, assume "+"
  • for W, add "-" to long; for E, assume "+"

Results[edit]

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.

Limitations[edit]

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[edit]

There are a few Web sites that provide useful lat/long information.


External links[edit]

Variants

Actions

Destination Docents

In other languages