Google-maps – Finding businesses within an ‘n’ mile radius of a point with Google Maps or Earth

bing-mapsgoogle earthgoogle mapsopenstreetmap

I'm working on an article that seeks to find a certain type of business within my borough. Ideally I'd be able to supply a KML file and have it return only businesses within those bounds, but I'm not super optimistic that's possible and thus am settling for another approach:

given a latitude/longitude set located in the centre of my borough, is there any way for either Google Maps or Earth (or even Bing or OpenStreetMaps or whatever at this point – I'm not picky) to return all businesses within a, say, 2.5 mile radius?

It seems like this is something Google Maps should be able to do; a query like "businesses Z near X,Y" does this somewhat (though it seems there's no way of defining what exactly "near" means).

Any thoughts?

Best Answer

You can use the Google Places API to get at this data. It will allow you to specify a Lat/Long coordination and return places based on a radius distance. There is also documentation for Javascript based application.

Here's some info from the first article on using Place Search:

The Google Places API allows you to query for place information on a variety of categories, such as: establishments, prominent points of interest, geographic locations, and more. You can search for places either by proximity or a text string. A Place Search returns a list of Places along with summary information about each Place; additional information is available via a Place Details query.

You will need to set up the API project in https://code.google.com/apis/console/ to get the required project key parameter.

Example request:

https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=<PROJECT KEY GOES HERE>