Google Static Map API Introduction

On several of my previous blog posts I ran into the need to show something on a map. While Google Maps was the initial idea to implement, all I wanted was a single image with a few lines or markers. Embedding a map seemed a bit much for this simple task. My second idea was taking screen shots of a Google Map with the lines/markers displayed, which is probably copyright infringement. This last idea led me to my solution: Google's Static Map API.

I've worked quite a bit with Google Maps in the past and really enjoy their API. It's easy and fun to work with, and the end result is simply amazing. The Static Map API, while being more restrictive in features, is no different.

The first step is signing up for an API key on Google's Site. This key is tied directly to the domain that your project is on, so you'll probably end up creating a few keys. After this is done, you can embed an image on your site just like any other image.

read more »

Distance Compare Class Part A

This post assumes advanced understanding of PHP scripting and some object-orientated knowledge.

One area of PHP that I haven't had much experience with yet is classes. I have a rough idea of what they do, but after working with a few inefficient classes, figured that they are more trouble then they're worth. It wasn't until one of my contract jobs specifically requested an application built up from a class that I actually built one from scratch and started understanding the true benefit of object-orientated programming.

In this scenario, the client owned about eight stores with unique addresses. They wanted a page on their website that allowed a user to input a zip code in a form to find the closest stores. There are several php classes online that can do this, but they depend on custom databases with zip code information built in and only calculate straight-line distances. As zip codes change over time, these classes became outdated quickly, requiring regular maintenance.

For this project, I decided to connect to Google Maps ...

read more »

Setting up the Hiking Website

Even though my waterfalls site turned out to be a great way to chronicle adventures through wilderness, it has several areas that are lacking. The biggest area is the Google Maps functionality, which is shaky at best. It can only show the end points and major points along the route, but I didn't have enough data to actually upload the suggested route (waypoint by waypoint) for each journey. Also, I didn't have any way of displaying or archiving my other adventures with the waterfalls site, so I decided to make an individual web project: the hiking site.

The layout for this site was fairly simple: a full screen map with removable sidebar containing the hike and view options. Utilizing the jQuery framework would allow me to add the Google Maps pieces easily and use cool animation on different elements. The largest step was the data transfer. I only wanted to return xml, preferably formatted as KML, and use Javascript to parse the data and display it correctly.

Breaking it down to the user's view... A user will visit the main page and see ...

read more »

Topographic Images on a Google Map

This post assumes intermediate understanding of the Google Maps API.

While I was working on a personal project I bumped into the need to create a Google Map that included locations and driving directions of the different Keweenaw waterfalls. This gave me the opportunity to learn about the Google Maps API, including displaying driving routes, arrays of points, and custom markers/descriptions. After working with Google Maps for awhile, I decided to take my website's map to the next level and add USGS topographic maps to the features.

Google Maps already offers several premade maps automatically with neat features, like Satellite, Terrain, and Map view that can work with street routes, but I needed to go a step further for a good topographic view. The maps work by displaying different 'tiles', or images, based on your zoom level and position. While the premade maps do all of this behind the scenes, to add custom maps (either self-made or supplied by another web service), I needed to sort out what tiles were needed and where to display ...

read more »