Wednesday, August 13, 2008

Google Local Search better than Google Geocoding?

Google offers two (apparently) unrelated solutions for doing geocoding (converting a text string into a latitude-longitude and a structured address): the Google Geocoding API (which is part of the Google Maps API) and the Google Local Search API (which has JavaScript and non-JavaScript variants). This post discusses our experiences with both and the results of recent testing we have been doing, which has led us to a decision to switch from our current hybrid approach to using only local search.

Initially we were attracted to using Google Local Search for whereyougonnabe, as it lets you search for places of interest like "Wynkoop Brewing Company" or "Intergraph Huntsville", rather than having to know an address in all cases - whereas the geocoding API only works with addresses.

However, in our initial testing with local search we found a number of cases where it returned a location and address string successfully, but did not properly parse the address into its constituents correctly (for example, returning a blank city). For our application it was important to be able to separate out the city from the rest of the address. In our initial testing, the geocoding API seemed to do a better job of correctly parsing out the address. In addition, it returned a number indicating how accurate the geocoding was (for example street level or city level). So we ended up implementing a rather ugly hybrid solution, where we first used local search to allow us to search for places of interest in addition to addresses, and then passed the address string which was returned to the geocoding API to try to structure it more consistently. In most cases this was transparent to the user, but in a number of cases we hit problems where the second call would not be able to find the address returned by the first call, or where the address would get mysteriously "moved". With so much to do and so little time :) we elected to go with this rather unsatisfactory solution to start with, but I have recently been revisiting this area, and doing some more detailed testing of the two options.

Before I get into more details of the testing, I should just comment on a couple of other things. One is that a key reason we are revisiting our geocoding in general is that we recently introduced the ability to import activities from external calendar systems, which means we need to call geocoding functionality from our server from a periodic background process, whereas before that we just called it from the browser on each user's client machine. This is sigifnicant because the Google geocoding API restricts you to 15,000 calls per IP address per day, which is not an issue at all if you do all your geocoding on the client but quickly becomes an issue if you need to do server based geocoding. Interestingly, Google Local Search has a different approach, with no specified transaction limits (which is not to say that they could not introduce some of course, but it's a much better starting point than the hard limit on the geocoding API).

Secondly, a natural question to ask is whether we have looked at other solutions beyond these two, and the answer is yes, though not in huge detail. Most of the other solutions out there do not have the ability to handle points of interest in addition to addresses, which is a big issue for us. Microsoft Virtual Earth looks like the strongest competitor in this regard, but it seems that we would need to pay in order to use that, and we need to talk to Microsoft to figure out how much, which we haven't done yet - and obviously if we can get a free solution which works well we would prefer that. Several solutions suffer from lack of global coverage and/or even lower transaction limits than Google. We are using the open source geonames database for an increasing number of things, which I'll talk about more in a future post, but that won't do address level geocoding and points of interest are more limited than in Google (currently at least).

Anyway, on to the main point of the post :) ! I tested quite a variety of addresses and points of interest on both services. Some of these were fairly random, a number were addresses which specific users had reported to us as causing problems in their use of whereyougonnabe. In almost all the specific problem cases, we found that the issue was with the geocoding API rather than local search. The following output shows a sample of our test cases (mainly those where one or other had some sort of problem):

I=Input, GC=geocoding API result, LS=local search API result, C=comments

I: 1792 Wynkoop St, Denver
GC: 1792 Wynkoop St, Denver, CO 80202, USA
LS: 1792 Wynkoop St, Denver, CO 80202
C: LS did not include country in the address string returned, but it was included separately in the country field. The postcode field was not set in LS, even though it appeared in the address string. Other fields including the city and state (called "region") were broken out correctly. This was typical with other US addresses - LS did not set the zip code / postal code, but otherwise generally broke out the address components correctly.

I: 42 Latimer Road, Cropston
GC: 42 Latimer Rd, Cropston, Leicestershire, LE7 7, UK
LS: null
C: The main case where GC fared better was with relatively incomplete addresses, like this one with the country and nearest large town omitted (Cropston is a very small village)

I: 72 Latimer Road, Cropston, England
GC: 72 Latimer Rd, Cropston, Leicestershire, LE7 7, UK
LS: 72 Latimer Rd, Cropston, Leicester, UK
C: Both worked in this case, with slight variations. GC included the postal code (a low accuracy version) and LS did not. LS included the local larger town Leicester which is technically part of the mailing address.

I: 8225 Sage Hill Rd, St Francisville, LA 70775
GC: null
LS: 8225 Sage Hill Rd, St Francisville, LA 70775
C: One of several examples from our users which didn't work in GC but did in LS.

I: Wynkoop Brewing Company Denver
GC: null
LS: 1634 18th St, Denver, CO
C: As expected, points of interest like this do not get found by GC

I: Kismet, NY
GC: Kismet Ct, Ridge, NY 11961, USA
LS: Kismet, Islip, NY
C: Another real example from a user, where GC returned an incorrect location about 45 miles away from the correct location, which was found by LS.

I: 1111 West Georgia Street, Vancouver, BC, Canada
GC: 1111 E Georgia St, Vancouver, BC, Canada
LS: 1111 W Georgia St, Vancouver, BC, Canada
C: Another real example from a user which GC gets wrong - strangely it switches the street from W Georgia St to E Georgia St, which moves the location about 2 miles from where it should be.

I: London E18
GC: London, Alser Strafle 63a, 1080 Josefstadt, Wien, Austria
LS: London E18, UK
C: Another real user example. London E18 is a common way of denoting an area of London (the E18 is the high level portion of the postcode). GC gets it completely wrong, relocating the user to Austria, but LS gets it right.


So in summary, in our test cases we found a lot more addresses that could not be found or were incorrectly located by the Google Geocoding API, but were correctly located by Google Local Search, than vice versa. It is hard to draw firm conclusions without doing much larger scale tests, and it is possible that there is a bias in our problem cases as our existing application may have tended to make more problems visible from the Geocoding API than from Local Search (it is hard to tell whether this is the case or not). But nevertheless, based on these tests we feel much more comfortable going with Local Search rather than the Geocoding API, especially given its compelling benefits in locating points of interest by name rather than address. These point of interest searches can also take a search point, which is also a very useful feature for us, which I will save discussion of for a future post. Advantages of the geocoding API are that it returns an accuracy indicator and generally returns the zip/postal code also, neither of which are true for Local Search. Neither of these were critical issues for us, though we would really like to have the accuracy indicator in local search also. For our application we are not too concerned about precisely how the addresses align with the base maps - one reason I have heard given in passing for Google having these two separate datasets is that they want a geocoding dataset which uses the same base data as Google Maps uses, to try to ensure that locations returned by geocoding align as well as possible with the maps. If this is a high priority for your application, you might want to test this aspect in more detail. It also appears that the transaction limits are more flexible for server based geocoding with Local Search.

So we'll be switching to an approach which uses only Google Local Search in an upcoming release of whereyougonnabe. I'll report back if anything happens to change our approach, and I'll also talk more about what we're doing with geonames relating to geocoding in a future post.

Wednesday, July 30, 2008

Off to San Diego next week - and more GeoWeb coverage

Well, after my first ever visit to the ESRI User Conference last year, I'm going to be back there again this year, with my Enspiria hat on this time. Hope to catch up with some of you there ... I'll be around at the Enspiria booth a good bit of the time (#1907). Also, Enspiria has organized a cruise on Wednesday evening which is filling up but we have a few spots left so if you'd be interested in joining us let me know and I'll see if I can get you a ticket (no promises though!).

In other news, my GeoWeb presentation has been continuing to get some good coverage - after Ogle Earth gave it a good review, it also got mentions at Google Earth blog, Google Maps Mania (twice), and by Paul Bissett at Fiducial Marks. I have a lot of notes from GeoWeb and will try to do a post writing up my thoughts on the conference soon. But I'm off to the Santa Fe Opera tomorrow morning for a long weekend, where I look forward to catching up with my old friend Warren Ferguson, so it may have to wait until next week :).

Friday, July 25, 2008

Nice review of my GeoWeb presentation

Stefan at Ogle Earth gave a nice review of my GeoWeb presentation:
I ended up watching Peter Batty's entire presentation at GeoWeb on "Future Location and Social Networking". I hadn't planned to, but I was surprised to find a lot more deep thinking than I imagined was possible about this market segment.
Thanks Stefan! As I try to explain in the presentation, I do think there's a lot more to this space than meets the eye, when you get more deeply into it. Stefan also mentions that there are some cool Google Earth visualizations at the end, which you can see separately here, though of course I enourage you to watch the whole thing!

Thursday, July 24, 2008

My presentation on "Future Location and Social Networking" at GeoWeb

I gave my presentation at the GeoWeb conference yesterday and it generated a good bit of interest. I recorded it with the brilliant ScreenFlow software which I have been using extensively to do screen capture videos, but this is the first time I tried it with a conference presentation and it worked very well. I talked previously about what I was planning to talk about - in summary, it's about the ideas we have about modeling future location for whereyougonnabe, and I talk quite a bit about the bigger picture of where we plan to take it - combining space, time and the social graph to create a new infrastructure for calendaring and scheduling. 

GeoWeb presentation: The Power of Future Location for Social Networking from Peter Batty on Vimeo.

It's about 30 minutes long but I encourage you to take the time to check it out, I really think that the whole future location area is a very interesting one!

Wednesday, July 16, 2008

OpenStreetMap mapping party in Denver this weekend (at my loft)

Steve Coast, the founder of OpenStreetMap, is visiting Denver this weekend for a mapping party which I will be hosting at my loft above the Wynkoop Brewing Company, followed by beers downstairs. We will be holding one on Saturday and one on Sunday, people are welcome to attend either or both. We'll start at 1pm each day with a talk from Steve about OpenStreetMap, which I think is one of the more interesting developments in the industry recently, as I've talked about before - a prime example of the "crowdsourcing" phenomenon. We encourage everyone to join us for some mapping too, but if you just want to come for the talk (or the beers later), that's fine too. Please sign up on the wiki page if you plan to come.

Here is more information from Steve:

OpenStreetMap, the free wiki world map is coming to Denver this weekend 19/20th July for a mapping party.

OpenStreetMap allows anyone to edit a map of the world, much like wikipedia allows anyone to edit a world encyclopaedia. A mapping party is an informal daytime event where volunteers of all walks of life help map an area collaboratively. GPS units and instruction is provided, together with help using the editing tools and ways to collect the data. For more about mapping parties, see here.

We will meet at Peter Batty's loft at 1792 Wynkoop St, #508, at 1pm. It will begin with a short presentation on OpenStreetMap and then you are invited to go mapping. Mapping some streets, footpaths or what interests you can take as little as an hour including being shown how to use the GPS and software. Afterward, we will retire to the Wynkoop Brewing Company and you're welcome to join us.

Please check the wiki page for up to date information.

Monday, July 14, 2008

Presenting at GeoWeb next week

I'll be up in Vancouver next week for the GeoWeb conference, which was excellent last year and it looks like there will be a good program and group of attendees this year too. Whereyougonnabe tells me that 13 of my friends will be in Vancouver at the same time as me, so it's good to see a few people starting to use the system!

I'll be doing a presentation on topics relating to future location, which is of course our focus with whereyougonnabe. As we've got further into this, I've really come to realize that there are some hard problems to solve in the space of future location which have a lot of value, and many ways that the core technology we're developing for our initial social networking application can be applied. I thought I'd just post a brief preview of some of the topics I'll be talking about.

Broadly speaking, I think that the hard problems fall into three main areas:

Modeling and performance. How you model future space-time has a huge impact on what you can do in your application - for example Dopplr is a nice application in many ways, but its underlying model of space-time has some serious limitations which really constrain the functionality they can provide compared to the approach we are using.  I'll talk about coarse-grained versus fine-grained modeling of space-time, and using discrete "places" versus a continuous coordinate system. Implementing a fine-grained system with the ability to handle variable search radii in both space and time is pretty challenging from a performance and scalability perspective with large data volumes, and I'll discuss some aspects of how we've approached this. I'll also talk about various interesting modeling challenges including handling overlapping activities, uncertainty (possible / probable activities), alternative plans (may be either here or there), flexible plans (I'm intending to go to the shopping mall sometime tomorrow afternoon), linear activities (like road or train trips).

Determining what's "interesting". Since we are focused on fine-grained future activities, which may be close to home or far away, users may be "close" to their friends frequently, and what constitutes "close" may vary significantly depending on the context. If I am in England for two weeks I am interested in notifications happening between me and friends who are within a relatively large distance of me (a hundred miles or so, say), whereas if I'm going out for a drink in downtown Denver, where I live, my notification radius should be relatively small. If I have friends who live close to the bar I'm going to, should I notify them about my plans or not - they may well be interested but we don't want to overwhelm people with too much information. I'll talk about factors involved in determining what's interesting, including the distance from home of each person, normal distance between the people, how often you see them, length and nature of the activity, and more.

Gathering data on future activities. Of course one of the big challenges with future location compared to current location is creating the raw data about where people will be and when. Obviously making it easy for people to create activities is one aspect of this, but integration with other data sources is also key, including calendars, online booking systems for travel, restaurant reservations, concert or sporting tickets, etc etc. As we pull data from multiple sources, merging those together in the optimal way can be challenging. I'll discuss a variety of ideas and plans we have in this area.

So that's just a taster of some of the areas I'll be talking about - I'll also talk about more specifics of what we've implemented so far and our experience with the technologies we're used, including PostGIS on the back end (which I've been really impressed with), Google Maps, geocoding and local search, the Ext JS Javascript Library, and more. And I'll talk more about the broader range of applications I see for what we're doing.

I'm talking from 4:30 to 5pm on the Wednesday, July 23, so if you'll be at the conference please stop by!

Sunday, July 13, 2008

Major new release of whereyougonnabe

Apologies again for the lack of posting recently ... a primary reason for this has been we have been heads down adding lots of new stuff to whereyougonnabe recently, plus I've been juggling a number of side projects. But anyway, we are excited about our latest release which went live over the weekend (you can access it here). 

The big theme of the release is integration - we can now automatically import activities from Google Calendar, Tripit, and Dopplr, we have added an iCal feed so you can view whereyougonnabe information in your regular calendar, and you can set your Facebook and/or Twitter status whenever an activity begins. In general, a big challenge with future location is how to create data as easily and automatically as possible, and this is a big step forward in that regard.

We also made significant changes to the way that we calculate interactions and decide what to notify you about, which I have come to realize is a very hard problem, as I have got more into this (which is good, as it is harder for other people to copy what we are doing).

You can read more specific information at our whereyougonnabe blog, or watch the following video for an overview of the new features:


whereyougonnabe July 2008 release overview from Peter Batty on Vimeo.

We also have several more detailed videos explaining how to set up and use the new features. Our big focus for the next release is on the user interface, an area where we have a lot of ideas and plans that we are excited about.