by Jonathan Moody
Libraries make up one of the larger purchasing segments for our products, but demand is driven by the patrons of those libraries. So a challenge is how to reach out to those patrons, and increase demand.
One marketing suggestion was to give library patrons a way to see where libraries were that ‘carried’ our products. Fortunately, Google Maps provides a very easy to use solution for mapping groups of locations.
The first task for the proof of concept was to get a list of customer addresses. Our library e-commerce web site stores customer addresses, which we can cross check against online orders. I ran a query and got back the addresses (address1, address2, city, state, zip) for libraries that had made orders. I then transferred that data into a MySQL server that was on the box where the POC was going to run.
The second step was to geocode those addresses, which was the first stage where I was able to take advantage of the Google map api. http://maps.google.com/maps/geo allows you to pass an address as a parameter, and get back an xml file that includes tags for latitude and longitude. Looping through the database records and updating that data based on the xml was relatively trivial, with the caveat that Google limits how many requests you can make on the free interface. In a production application the initial coding might need to be done over multiple days, with updates running incrementally after that.
A couple of issues crop up in terms of how to use this tool. Do customers really want to show up on a map based search of ours, and which customer data do we use to seed the database? We’ll see how those questions play out. Whether this specific application ends up being implemented or not, I now know how simple it is to take advantage of the Google api for a variety of geospatial applications.