Incorporating Grab A Grid Reference into a website

This version is no longer available, please see the instructions for the other versions of GAGR

  1. Save the source code - the HTML page.
    You choose to use our code at your own risk, without any guarantee of anything, or any support. (It's free after all!)

  2. Obtain your own key for Google Maps by signing up here: http://code.google.com/apis/maps/signup.html
    Replace our key with yours. The key is the red bit in this line:

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCWtY9tNaUEo4UuagVMKnv6WVBlBzUwwMQ&amp;v=3&amp;region=GB"> </script>

    WARNING: The blue bit in the code above is the version of Google Maps to use. At some point this version of Google Maps will be deprecated and superceded. All Grab-a-Grid-Refs may suddenly stop working when this happens. - don't blame us. Google Maps has lots of very good online documentation, and a forum for resolving problems, and is the place to turn to for help with anything to do with Google Maps.

  3. If you are using the Duo version then you will need to obtain your own key for Ordnance Survey OS OpenSpace API by signing up here: https://openspaceregister.ordnancesurvey.co.uk/osmapapi/register.do,
    Replace our key with yours. The key is the red bit in this line:

    <script type="text/javascript" src="https://openspace.ordnancesurvey.co.uk/osmapapi/openspace.js?key=874C5F8149CE6DCBE0530B6CA40A40B4"></script>

    (You will probably need to upload the webpage to your website for the maps to work. You can't always test them on your own PC).

  4. Centre the start point where you want by changing the latitude and longitude, and the initial zoom amount:

    function initialize() {
    var a = 52.030714; // Start latitude
    var b = -0.472808; // Start longitude
    var myOptions = {zoom: 13,


  5. If you don't want county boundary buttons, just remove the code between

    <!-- Start of Boundary controls -->

    <!-- End of Boundary controls -->


  6. You should include a link to the GNU General Public License Version 2.

  7. Add a link somewhere to refer your users back to this website, so that they can find the latest version as we continue to develop the tool.

That should be it, everything else is cosmetic. But you will obviously need to change formatting to your own house style.