Jump to content

Wikivoyage:Geocoding

From Wikivoyage

It's possible to encode information about the latitude and longitude of a destination, or of individual points of interest at the destination, into the guide itself. This information is used to generate locator maps and special HTML tags (hCards) which relate a Web page to a geographic location.

Syntax

[edit]

28666 of 28711 destination articles have a Geo parameter.

99.843 % complete

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}}

which renders the map link in the upper righthand corner of that page.

A world map showing all geocoded destinations in the English-language Wikivoyage appears at https://wikivoyage.toolforge.org/w/artmap.php?lang=en

Note that only one {{geo}} instance in a page makes sense.

For an individual point of interest

[edit]

To encode GPS information for listings in Wikivoyage, use the lat and long attributes in the {{listing}} tags or template. Each listing item displays an icon with a link to a locator map with the supplied decimal co-ordinates.

A {{listing}} or {{marker}} typically locates a point of interest, such as an individual landmark or building.

{{listing | name=Ingleside | alt= | url= | email= | address= | lat=45 | long=-75 | directions= | phone= | tollfree= | fax= | hours= | price= | content= }}

or:

{{marker |type=city |name=Ingleside |lat=45 |long=-75 }}

gives:

  • 1 Ingleside.

...with an icon linking to an OpenStreetMap-based locator map. The 'type' is normally one of (see, do, buy, eat, drink, sleep, listing); the use of cities as points of interest may occur in itinerary.

As this allows decimal co-ordinates to be specified for every individual listing, it can be useful for pinpointing locations with no street address (such as statues or markers surrounded by parkland). See Wikivoyage:How to use dynamic maps for details on using geocoded POI's and GPX paths to build dynamic maps.

Metadata

[edit]

In the past, we used the Resource Description Framework (RDF) format to encode one pair of lat/long co-ordinates into each page; a template generated HTML code like:

<rdf>
  <> dcterms:spatial [ pos:lat "45.5" ; pos:long "-73.6" ] .
</rdf></nowiki>

to indicate that "this page covers something with lat/long of 45.5/-73.6". Wikivoyage does not currently use RDF, instead using the hCard microformat to encode (lat, long) co-ordinates for each listing in a format which can be read (and downloaded as a .kml file) by the Firefox Operator extension. These also provides a vCard-like format for contact info for each templated listing.

The hCard microformat is generated automatically by the {{listing}} template.

Limitations

[edit]

Because the RDF system assigned a single geographic point to the entire destination guide, it was only suited to locations that were 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; effectively, only city guides were amenable to geocoding in this way.

This functionality corresponded to the current {{geo}} tag. Wikivoyage eV now generates world maps based on these co-ordinates, for instance https://wikivoyage.toolforge.org/w/artmap.php?lang=en which uses the geo tags in Wikivoyage:database dumps.

With the hCard format, it is possible to assign points to individual listings in a guide using Wikivoyage:Listings. From these, {{mapframe}} may be used to place an automatically-generated locator map on-page at the local (city/town destination) level.

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 "+"

Sources for lat/longs

[edit]

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

  • OpenStreetMap (OSM) – Browse the map, click with the right mouse button on the desired location and select "Show Address". The lat/long value of the location can then be copied from the text field in the upper left part of the website.
    • Nominatim – OSM reverse geocoding
    • If a destination has a geo tag, there will be a map icon at the top right of the article. If you know the area, then you can get co-ordinates for listings by going to that map (of any article), positioning the mouse pointer, then right-clicking to show lat and long info.
  • Wikipedia gives co-ordinates for most articles about places
  • Geomap – search via OSM Nominatim, provides coordinates in WV templates formats
  • Geobatcher is a tool which can take an entire section of Wikivoyage listings, and insert coordinates for up to 100 listings at a time. More instructions in article, How to use dynamic maps.
  • Multimap lets you search for cities in many countries and returns lat/long info (some problems with non ASCII chars in the names)
  • The Getty Thesaurus of Names has lat/long info for most cities in its database
  • The Global Gazetteer from Falling Rain Genomics, Inc. is another database that gives decimal geocode values for many place names around the world.
  • Richard Cyganiak's FOAF mapper – Find co-ordinates using Google Maps.
  • GeoNames - Quick and thorough geocoding

See also Wikivoyage:Dynamic maps Expedition#Sub-expedition: Fill all the latitudes!.

See also

[edit]
[edit]