February 10, 2012

Geohack easy copy/paste (Greasemonkey script)

Geohack copy/paste

A recent project required research into the locations of communities and institutions, using Wikipedia (among other sources). Many pages on the open encyclopedia include coordinate information, which links to the GeoHack extension. An example is this GeoHack page for Stockholm.

To make it easy to copy the decimal coordinates into a spreadsheet or database (in our case, it was Microsoft Access), the following script was constructed. The goal was to add a button, with access key defined, to open a box from which the user could copy the information to the clipboard. The decimal coordinates are separated by a tab character, to facilitate pasting into a database/spreadsheet.

GreasemonkeyThe script was set up for Firefox 10 using Greasemonkey 0.9.15. Greasemonkey is a browser add-on that makes it possible to set up small, simple Javascript snippets that modify the content of webpages.

See below for the full code for the Geohack easy copy/paste script. It should apply to all pages found under

To install the geohack_2012.user.js, click here.

The code is available for unrestricted download under a Creative Commons Attribution 3.0 Unported License. This gives you the right to redistribute and modify the script, as long as Nordpil is properly credited.

Releases and versions

  • version 1.0, February 9, 2012