Google Maps API

Posted by Danny Choo [www] 
Mouseover photo to load notes or add comment
Google Maps API

So I was babbling on about how cool google maps was in a previous post but lo and behold Google have also released an API to compliment their mapping shenanigans.

What you have to do is to get yourself along to the Google Maps API pageand sign up for an API key - which is quite painless - just ignore the "API terms and conditions" and after you have checked the box for the "I have read and agree with the API terms and conditions" (who on earth reads these things?) stick in a URL and click and then hit "Generate API Key". You may have to do this twice because the key you generate for www.yourdomain.com wont work if you are developing on localhost so stick in "http://localhost:1117" (or whatever port number) to generate a key for development purposes.

Unless you have a GPS unit built into your left knee, you will need to find out the longitude and latitude coordinates of the location you want to map - the only way I know of so far is to type an address into Google Maps and then click on the "このページのリンク" or "link to this page" link - then look at the source of that page - the coordinates will be in the "<point lat="35.630681" lng="139.719003"/>" tag.

Below is a sample of what I threw together this afternoon. You have to click on the map through to a different directory because the API key generated is only good for any files directly under "www.dannychoo.com/" - if the file is under "www.dannychoo.com/blogg_entry/" then the key wont work. Go ahead and click on my logo. As you can see, I can choose the location using longitude and latitude coordinates, choose the icon that I want to show and the text that will appear when you click on the icon. There are a heap of things you can do with this API and I have only just scratched the surface. Here is a good example of what can be done with the API. I will probably integrate this with all the photos I have taken around the globe or something. Or something useful like use it to show all the locations where I have made enemies.
Download the code used to generate the map that you see below and refer to the official API documentation here to get you going.

By the way, I was using the US version of Google Maps searching for monument valley and found an Alien base.... what do you think?





About MascotsSubscribe by EmailTwitter Facebook

Read more about this site or close this welcome panel.

This item was posted in the Misc category. You can see more of everything else or subscribe via RSS instead.
-Japan Probe - News from Japan (Subscribe)
-Akihabara News – Gadgetry from Japan (Subscribe)