Developer

Make the most of mapping down under

Map-based mashups are appearing everywhere. Whether you're planning a bike commute or looking for hotels, Andrew Muller shows how Aussies can incorporate maps into applications.

Map-based mashups are appearing everywhere. Whether you're planning a bike commute or looking for hotels, Andrew Muller shows how Aussies can incorporate maps into applications.

Mapping has been used in the past as part of specialist enterprise solutions, the last 18 months has seen a number of free online mapping services become available with Google making the biggest name for itself as the preferred destination for user features and developer offerings.

The big G is not the only one providing mapping services, especially for users in the US - Yahoo!, Microsoft and Amazon are also players. When it comes for searching for a street address they all have similar offerings, but there are one or two interesting extras available if you're looking for them.

Amazon, through its A9 search engine includes what it calls "BlockView Images" with location search results for 24 major US cities. Four consecutive photographs of either side of the street for the chosen location are displayed with a selected enlargement - great for deciding if a hotel you're booking is in a nice area or surrounded by houses of ill repute.

The French did something similar some time ago; they included a photograph of the façade of every street address listed on the Pages Jaunes site (Yellow Pages) for the nine largest cities.

Yahoo!'s offering is currently for North America, a beta version is written in Adobe Flex, with the standard street maps and satellite imagery it's interface has a more polished feel than the Google Maps offering built in AJAX. It performs more like a piece of desktop software than a web application and offers some nice extras like a traffic report overlay.

Windows Live Local is Microsoft's mapping site. Another AJAX application, it is more visually appealing than Google Maps and offers integration with both Outlook and MSN Messenger. It also has a novel feature called "Bird's eye" where detailed aerial photographs are offered for selected US cities to supplement the satellite photographs.

Of all the sites reviewed for this article Windows Live Local was fine on IE and Firefox but would not work on Safari; so much for the great promises of AJAX and cross browser compatibility.

ESRI is the largest commercial supplier of mapping services. They have various maps available with street, relief and various thematic maps. They offer a no-cost subset of their commercial offerings for personal and non-commercial use.

While most of us are familiar with the location searching and driving directions that the Sensis site Whereis offers there is another Australian site to consider, Zoomin.

Zoomin offers full address searching for Australia. It also offers users a community experience with the ability to organise locations into groups, host discussions, rate locations and upload and associate images with locations. These Zoomin groups could be used in exactly the same way as someone could develop a mashup with another service to display all their favourite comic book stores.

Location, location, location would have to be Sydney's catchcry, and that's what online mapping is all about. The primary reason for including a map on your site would be to display the location of your business. Another reason could be to display information - the location of a place, object or event.

Let's look at the main online mapping services and consider what they have to offer.

Google it
Google Maps is certainly the most popularly used mapping API. It's free to deploy and has recently added street maps for all of Australia. A working knowledge of JavaScript is required to develop with the API as it has been built with Google's AjaXSLT framework making use of both JavaScript and XML.

If unsure, a bit of Googling should find a number of sites that focus on how to produce the necessary code for whatever kind of location mapping you want to use Google Maps for, many of them not only give sample code but also offer online applications to generate the necessary code for you.

You need to sign up for a Google Maps API key to use and deploy the API; in addition to documentation Google offers sample code, blogs and forums to help developers get the most out of the API.

While you have to nominate the site for deployment when applying for the API key you can still develop and test on your local system before deployment. A simple map displaying a location is quite straightforward to put together, even easier if you take advantage of one of the online code generators.

Poor search
The big drawback to using Google Maps right now is that it does not offer an address search for Australia. Driving directions are not there either, kind of obvious why not, but I don't think that feature would be an immediate priority for developers. Google are yet to announce a date for either feature, which means that for now you will have to do a work around to add address locations to your maps.

Is that such a big deal? I guess that depends on your application. It certainly saves a lot of time locating a place on the globe, but in the scheme of things it may not be a big issue. Let's put things into a perspective for starters. Google Maps currently has streets for Australia, Canada, Japan, New Zealand, the United States and most western European nations. It's not possible right now to build an application with Google Maps that offers global street searching.

What you can do is enter city name comma Australia into the search interface, e.g. Mackay, Australia, and Google Maps will return a map centred on a city for most cities in Australia - suburb names unfortunately do not appear to work, Sydney for example is as good as it gets.

From the Google Maps mashups that I've seen I don't believe that the current lack of searching should necessarily be impedance to building an application. Two that I tried while doing the research for this article have especially led me to believe that.

The first, a geotagging application for Flickr, used an interface based on Google Maps to find a location on the globe. You started with the world and started zooming in. Having a basic knowledge of geography helps but this application made use of the hybrid version of Google Maps, satellite with a street map overlay, and it didn't take too long to find Sydney/suburb/street/landmark for a number of locations.

The BlockRocker application then generated geotags for each location using the latitude and longitude indicated for a chosen photograph on Flickr and added the necessary tags to the photo details.

The second is the recently launched Bikely, an Australian based AJAX Google Maps mashup that allows users to map and share bicycle trips. It attempts to make use of the basic city search to help in locating the journey's commencement point - users, if not successful, search using the zoom method previously outlined.

The position of each major point of the journey is tagged or pinned with a mouse click, notes are easily added to those locations making these either useful for navigation or to indicate points of interest. The application is intuitive and easy to use, the maps are easy to follow and extras like calculating the distance of the trip are welcome.

Bikely is a good example of "if you build it they will come".

Although recently launched it's obviously well used already with a large number of bicycle journeys already added in a short time and a ready number of volunteers on the forums offering their services to help extend the application. While the majority of bike tripe created are for Australia there are others for the US and Canada.

Not having street searching was not an issue for Bikely's developer. They must have believed enough in their product to launch it without, making use of the search methods described in the geotagging application above. I believe that it's due to the success of early adopters using the site.

They're the type of people who are prepared to put up with a lot, who will give something a go if it's cool, interesting or useful enough - they're also the people who will spread the word if the product is good.

If the concept is good enough, the hosting costs acceptable and there's someone who's prepared to run across the road for a double shot latte every now and then you shouldn't let the absence of street searching stop you from building a good mashup.

Inserting data
If you've got a lot of locations that you want to add to your map you've got a lot of searching to find where to add those red push pins. The easiest way to do this for use within a Google Maps application is to do a latitude and longitude lookup for each location.

It's a question of how to get that data into a map for multiple lookups. All of the mapping solutions described internally use latitude and longitude to locate addresses on their maps. The solutions on offer from Sensis and Zoomin both have search facilities, Zoomin offers a Geocoding API.

Geocoding is the process of calculating the latitude and longitude of a given location, this information can then be used by a mapping service like Google. It would be used to convert a list of addresses stored within a database that needs to be displayed within your mapping application.

One way to geocode would be to make an application call to the Google search interface and parse the latitude and longitude from the returned results. More desirable would be to use a web service or REST call to fetch the data.

There are a number of commercial web services that offer geocoding for street addresses, a few include Australia. It appears that this is quite a desirable commercial service, Zoomin's service works well - you can view a working version of it in the developer section of their site. I haven't been able to find any free geocodeing services available as with either web services or non captcha interfaces.

Other major services
While their mapping is only for North America Yahoo! deserve a mention because of the multiple APIs that they have on offer. There's three: Simple, AJAX and Flash. Flash is divided further into ActionScript, JavaScript and Flex APIs. They are the only street mapping service offering a Flash API for free. ESRI, a commercial GIS provider mentioned previously also has a Flash API that is also available for personal and non-commercial use.

Yahoo! also offers a free geocoding service for North American addresses. Have a look at the licensing for Yahoo!'s mapping services and you'll find that they have a rate limit of 50,000 queries per IP per day, Google Maps has no limit.

And what of Windows Live Local, Microsoft's offering? Interestingly they introduced street mapping for Australia at around the same time as Google Maps - they are apparently using the same provider of map data, visually they're different.

They, like Google Maps, are yet to introduce address searching for Australia. Their API is not dissimilar to Google's but I'm yet to find a mashup built with their API that is not on a Microsoft or Microsoft affiliate's site. Their satellite photography for Australia is also restricted to a minimum of one mile.

Most Windows Live Local examples I've found do not work with Safari, in fact the Windows Live Local site itself does not. While Mac users may account for a small percentage of the total desktop you have to realise that they have a higher than normal representation (some say as high as twenty percent) in early adaptors where it counts in getting the word out.

The other thing to consider about both Yahoo! Maps and Windows Live Local is that the licensing for both essentially prohibit you from deploying their maps alongside any competing service that they also offer - that would include mixing it with Google Adwords which could put a stop to your planned revenue if you're going to strictly adhere to licensing.

Others have also commented on the accuracy of mapping data including what is on offering here in Australia from Google Maps. Maps are only useful to users as long as their data is correct and up to date.

As a consumer the Zoomin site is worth checking out, it's community features might be a good way of prototyping your mashup ideas - finding out what folk want from the data that you have or are interested in using. It's grouping of locations, uploading of photographs and discussions are under utilised, and I've noticed that one fellow in Canberra has kick started off a comic store listing so let's get behind that.

Right now I'd consider it to be an excellent time to get in early and learn the Google Mapping interface. While Google is not currently offering address searching to users or developers for Australia you should consider this to be your beta period, as no doubt it can't be all that far away. Close enough for you to have other aspects of mapping development worked out.

Most AJAX applications have too simplistic and similar an interface for my liking, as a Rich Internet Application developer I'd like to see a Flash API for Google Maps like the offerings from Yahoo! - it doesn't appear as though that's going to happen in the near future. Perhaps the solution is to reverse engineer the Google Maps JavaScript API, this could be a great project for OSFlash.

The kinds of mashups that have become popular recently are in the end fancy ways of sticking virtual pins into maps, but you can bet that enterprising developers will be along shortly to take it to the next level.

Editor's Picks

Free Newsletters, In your Inbox