December 27, 2006

Geocoding Tool for Virtual Earth & Google Maps

Would you like to be able to geocode Virtual Earth and/or Google Maps without the hassle? Or how about any application requiring the use of javascript?

Well, you can use this API for it:

It is a javascript API and you can call it like so:

The base URL is:

To enter a freeform location (you have one entry box that accepts any address format such as street address, zipcode, city/state, etc):,+Mountai n+View+CA++94043
In other words, just use the “loc” parameter. Currently, only the US is supported for freeforms….I have to decode all potential formats for non-US addresses.

If you would like more accuracy (or international support), break the text entry fields up into multiple fields. Mix and match and use whichever you’d like from the following parameters:
address (street address)
some examples: &country=UK

The default URLs above are for the Google Maps API. To use the Virtual Earth API, construct the URL the same as you would above and add the following parameter “&ve=1″ … for example,,+Mountai n+View+CA++94043&ve=1

Alternatively, if you choose to use neither Google Maps nor Virtual Earth (or to have better control to do what you want), you can set a callback parameter with ‘cb=<MethodName>’ like so: tMethod

Some intillegence is there to try to guess the appropriate one…however, if you prefer to override it with your own, you can add the parameter “level=
For example: yields Google Maps zoom level 4
but you can force it to zoom level 1 by using this url:

Default behavior is for an alert to happen onerror (currently there are only 2 errors: ‘location not found’ and ‘Please provide a location’). To override this behavior, you can specify a callback for errors by adding a parameter ‘cbe=<function_name>’
For example, the first link below will provide an alert error but the second one will use the specified callback:

If you are not very familiar with javascript and how to leverage this, you can take a look at some of the source of some of the sites using them:
Virtual Earth example
Google Maps Example

Basically, you’ll either use a “script src=<URL>” or

var s = document.createElement( “script” );
s.type = “text/javascript”;
document.getElementsByTagName( “head” )[0].appendChild(s);

Recommendations? Errors? Feature requests? Post them here and I’ll try and fix/add.

UPDATE: You can now lookup information and geocode by IP Address.
To lookup by the requesting IP address, just add “by_ip=1″ like so:

To get city/state info, use a callback:

To lookup an IP address by passing it in, rather than using the requestor’s ip:

Keep in mind, when using IP addresses, that this info isn’t always very good and, in fact, many IP addresses will not have any data. I have built it in to try looking up by IP address when the by_ip=1 parameter is used but to fall back on the other lookup info (i.e. loc or city infor passed in) if the IP address lookup fails.

To try it out, check out the virtual earth or google earth geourl sites and click on the “Guess by my IP Address” link.

UPDATE: API now supports &phone= as well as &format=.
The phone parameter tries doing a reverse lookup to find an address then geocodes that address for you.
The format parameter accepts “XML” or “json” to output in those corresponding formats. Here is an example utilizing both of these features:
The above is a lookup of the Burbank Chamber of Commerce phone number.

So what am I asking in return for use of this tool?
Well, I’m asking (but not requiring) a reciprocal link to either the homepage or to this blog’s homepage.

Any usage limitations?
Well, if you overburden this server, I might throttle you or even shut you down if you abuse it (never happened yet!). If you think you are blocked, feel free to email me and I will unblock you as long as we clear up any issues.

UPDATE: I have added a new feature as of 2004/02/24. You can now do a reverse lookup of lat/long to address. It currently is much more limited in area and in accuracy than other components of this framework and its performance/response time is not that great yet so use with caution and I will improve over time (feedback always welcome).
To use it, just specify a latitude and longitude in your request like so: 5116

Like this service? Help make sure it keeps a good level of service (or even improves it) by donating:

… or how about just a link back to me or

1 Star2 Stars3 Stars4 Stars5 Stars (12 votes, average: 4.75 out of 5)
Loading ... Loading ...

December 4, 2006

Ask Goes Local

Ask finally launched its Ask City, their take on local search.

They utilize a number of other IAC companies (Ask is an IAC company) to supplement their data such as Citysearch, Evite, and Servicemagic. They also incorporate a number of other partners not part of the IAC family.

While users of Citysearch will realize this is nothing new…Citysearch has been doing this for years, merging records from multiple data sources through partnerships and such…Ask, however, does it differently. They use their own search engine and, therefore, rank on their own idea of relevance rather than Citysearch’s take on it (which uses FAST). They also decided to use similar interfaces to Google (the map is central to the interface) and MSN’s Local Live (which uses various panes to utilize differing functions).

Ask separates out the various search types such as locations and events rather than creating a singular box/set of boxes that searches across all of them. While this diminishes convenience, it tends to increase accuracy/relevance of results. They also do as Google Local and Openlist has done and incorporate listings from a number of competing local search sites such as Insiderpages, Judysbook, and Yelp.

So, in short, this product is different than their “Local” product that they originally had which was built entirely of of citysearch where they accessed their content and utilized their search engine through an API. It incorporates more data and has a different interface. The ability to draw over the map and save the map is nice but I’d only want to do that to send it to someone with remarks on the map (i.e. Here’s how to get there…) and you can only email a link to that page rather than the image. I don’t like having multiple different panes for various functions. While it tends to increase relevance by narrowing down what the user intends, it tends to be cumbersome and I have to spend time searching around the page to find what it is I need to click on.

Disclaimer, look at my “About me” section.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...