Incorporating Grab A Grid Reference into a website
As I'm now getting so many requests from webmasters about how they can include this tool on their website,
I am no longer able to find the time to provide individual support, so I've documented the key points below:
Note: These instructions apply to the "Solo" map version. Instructions for the "Duo" version aren't yet written - the code is still being developed!
- Save the source code.
You choose to use my code at your own risk, without any guarantee of anything, or any support. (It's free after all!)
- Obtain your own key for Google Maps by signing up here: http://code.google.com/apis/maps/signup.html
Replace my key with yours. The key is the red bit in this line:
(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).
WARNING: The blue bit in the code above is the version of Google Maps to use.
At one stage this was the only version that it worked with! (I don't know the current situation).
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 me if they do!).
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.
- Centre the start point where you want by changing the latitude and longitude in the following line, and the initial zoom amount, currently 11.
map.setCenter(new GLatLng(52.030714, -0.472808), 11);
Delete all of the code between the lines:
<!-- Start of StatCounter Code -->
<!-- End of StatCounter Code -->
This is my web statistics code. (If you don't delete it it will mess up my web stats!!!) I can recommend www.statcounter.com if you don't already use something.
If you don't want the VC30 and Bedfordshire boundary buttons, just remove the code between
<!-- Start of Boundary controls -->
<!-- End of Boundary controls -->
If you do want similar buttons, then include your KML/KMZ files in place of mine in the lines:
ViceCounty = new GGeoXml("http://www.bnhs.co.uk/focuson/grabagridref/html/VC30.kmz");
County = new GGeoXml("http://www.bnhs.co.uk/focuson/grabagridref/html/BedsBoundary.kmz");
You should include a link to the GNU General Public License Version 2.
Add a link somewhere to refer your users back to this website, so that they can find the latest version as I continue to develop the tool.
That should be it. Everything else is cosmetic I think. You'll obviously want to change formatting to your own house style.
Please let me know when you get it working online and I'll add a link from mine to yours to build the grab-a-grid-reference community.