Skip to: Site menu | Main content

gmap

Custom GMap Solution for Automatically Centering on User Location (Part 3)

In my previous two posts, I discussed how I implemented dynamic markers and the PdMarker custom marker type into the home page for OffRoadAtlas.com. The final major GMap customization I added was the ability of the map to automatically center and zoom on the user's location based on their IP address. The solution isn't always perfect (depending on the user's internet access provider), but more often than not, it gets pretty close.

The tricky part of implementing this feature was being able provide it for anonymous users while Drupal caching mechanism was activated. Later in this post, I'll show you how I did it using a combination of hook_init(), cookies, and Javascript.

Submitted by michael on Sun, 08/31/2008 - 10:33am
Filed under:

Custom GMap Solution for Dynamically Updated Markers (Part 1)

I recently upgraded OffRoadAtlas.com with a custom map interface based on the GMap module. I was able to do this while leaving the GMap module is virtually un-hacked (with the exception of modifying the "GMAP_API_VERSION" variable) - all of the customizations were made via an additional "helper" module that was written specifically for this site.

The site utilizes a map on the home page that shows all the off-roading areas and clubs in the database. The problem I was trying to solve was that I didn't want to have to load all 1,500+ points each time the home page was hit. Not only was this a waste of resources, but it also slowed things down considerably for the user.

Submitted by michael on Mon, 08/25/2008 - 10:08am
Filed under: