Wikimedia blog

News from the Wikimedia Foundation and about the Wikimedia movement

Posts Tagged ‘geotagging’

GeoData: a new age of geotagging on Wikipedia

On mobile devices, GeoData will allow you to view Wikipedia or Wikivoyage pages about places close to your location.

On mobile devices, GeoData will allow you to view Wikipedia or Wikivoyage pages about places close to your location.

Have you ever wondered if there are Wikipedia articles about things near you? Well, wonder no more! Today, we present the GeoData extension for MediaWiki, which now provides a structured way to store geo-coordinates for articles, as well as an API to make queries around this information.

What does it do?

Coordinates added to articles are now stored separately in the database, as opposed to being stored arbitrarily in wiki markup. This makes it easy to query the coordinates of a particular page or a list of pages around a given set of coordinates. The Solr search engine is used for spatial queries, making the searches extremely fast. All the functionality is also available via the API, allowing developers to create tools that use this data.

Where will it be used?

One of the first major uses of GeoData information will be in the experimental mode of the Wikipedia mobile site, which will allow beta users to see a list of nearby articles. We expect to release this feature into our experimental mode in the coming weeks. In the future, we also hope to build this functionality into our contribution tools: for instance, we’d like to be able to show users a map of articles needing images near their location, so that they can easily take and upload photos of subjects around them missing an illustration.

How does it work?

GeoData adds a new MediaWiki parser function called {{#coordinates}} that saves coordinates passed to it into the database. For example, if the Wikimedia Foundation office is located at 37° 47′ 13.09″ North, 122° 23′ 58.84″ West, it can be tagged like that: {{#coordinates:primary|37|47|13.09|N|122|23|58.84|W}} or with decimals: {{#coordinates:primary|37.78697|-122.39967}}. primary indicates here that these are the coordinates of the article’s primary subject, as opposed to other coordinates mentioned in the article.

How do we add it to articles?

GeoData requires some manual setup to start collecting data on a given wiki. The {{#coordinates}} tag needs to be inserted into the template used for geotagging (example change), and the job queue will process the pages that use it. This can be done on all sites where the GeoData extension is enabled: all Wikipedia and Wikivoyage sites, as well as special projects (like Commons). At least four projects are already actively using it: Wikipedia in English, German, Simple English and Chinese.

It’s also recommended to create a tracking category to which GeoData will add pages with invalid coordinates. The name of this maintenance category can be localized by editing the MediaWiki:Geodata-broken-tags-category system message. If you need help setting up GeoData on your wiki, join us on the #wikimedia-mobile channel on Freenode IRC, and we’ll be happy to help.

Max Semenik
Software Engineer, Mobile