Tomas Ramirez Sarduy
Tomas Ramirez Sarduy

Reputation: 17481

Get nearby attractions, given a latitude, longitude and radius

I wonder if there will be some API or web service that given a longitude and latitude, return me a list of names of places of interest nearby (coul'd be restaurants, hotels, etc). I've been searching Google and I find nothing interesting. Something that return a JSON object will be great ;)

Upvotes: 3

Views: 7680

Answers (3)

Hamish
Hamish

Reputation: 23354

Koordinates has an API for lat/lng queries of arbitrary spatial datasets. The response can be XML, JSON or JSONP. See this page for info:

For example, any of the Points of Interest (POI) layers listed here can be queried using a latitude, longitude and search radius:

You can upload and use your own data for free, so if you find a more suitable set of data for your location you can add that too.

-- EDIT: Example, more info after first comment --

For Cuba you'll need to find/create your own Points of Interest dataset - for example, maybe grab a subset of the OpenStreetMap data for your area. Basically you'll need to find/create a Shapefile point dataset to upload.

Once you've done that, you cna use the vector API linked above. For example, in New Zealand we have a good POI layer supplied by Zenbu:

Use the vector API to grab features within a certain radius. E.g. to find 10 nearest points within a kilometre of my (rough) location I can hit this endpoint (using a key I've generated for this answer. You can create your own API key for free):

The response looks like this:

{
    "vectorQuery": {
        "layers": {
            "1225": {
                "crs": {"type": "name", "properties": {"name": "EPSG:4326"}}, 
                "field_names": ["ID", "NAME", "TAGS", "WEBSITE", "ADDRESS", "PHONE", "HOURS", "CATEGORIES", "CREATED_AT", "UPDATED_AT"], 
                "type": "FeatureCollection", 
                "features": [
                    {"distance": 49, "type": "Feature", "properties": {"WEBSITE": null, "NAME": "Harrier Exports Ltd", "TAGS": null, "CREATED_AT": "2007-07-06 14:12:35", "UPDATED_AT": "2007-07-06 14:12:35", "HOURS": null, "PHONE": "09 369 5475", "ADDRESS": "28 Heather Street, Parnell, Auckland", "ID": 1106637.0, "CATEGORIES": null}}, 
                    {"distance": 53, "type": "Feature", "properties": {"WEBSITE": "http://www.asics.co.nz", "NAME": "Brittain Wynyard & Co Ltd", "TAGS": null, "CREATED_AT": "2007-07-06 14:05:02", "UPDATED_AT": "2007-07-06 14:05:02", "HOURS": "Mon-Fri 0630-1730", "PHONE": "09 309 0519", "ADDRESS": "Britwyn Building, 22 Heather Street, Parnell, Auckland", "ID": 1102514.0, "CATEGORIES": null}}, 
                    {"distance": 74, "type": "Feature", "properties": {"WEBSITE": "http://www.stagecoach.co.nz/thelink/", "NAME": "Link Bus - Parnell bus stop: Cracroft Street  (to city)", "TAGS": "Link Bus Stagecoach Parnell", "CREATED_AT": "2007-03-12 20:27:36", "UPDATED_AT": "2007-03-12 20:44:58", "HOURS": null, "PHONE": null, "ADDRESS": "81 Parnell Rise", "ID": 1094917.0, "CATEGORIES": "BusStation"}}, 
                    {"distance": 76, "type": "Feature", "properties": {"WEBSITE": "http://www.thorburn.co.nz", "NAME": "Thorburn Consultants Limited", "TAGS": "Engineering consultants", "CREATED_AT": "2007-03-13 12:49:21", "UPDATED_AT": "2007-03-13 12:49:21", "HOURS": null, "PHONE": "(09) 309 5339", "ADDRESS": "81 Parnell Rise, Parnell, Auckland", "ID": 1095258.0, "CATEGORIES": "Store"}}, 
                    {"distance": 81, "type": "Feature", "properties": {"WEBSITE": "http://www.wspa.org.nz", "NAME": "WSPA New Zealand", "TAGS": null, "CREATED_AT": "2007-07-06 14:35:53", "UPDATED_AT": "2007-07-06 14:35:53", "HOURS": null, "PHONE": "09 309 3901", "ADDRESS": "Level 1, 18 Heather Street, Parnell, Auckland", "ID": 1116272.0, "CATEGORIES": null}}, 
                    {"distance": 82, "type": "Feature", "properties": {"WEBSITE": "http://www.orangerealty.co.nz", "NAME": "Orange Realty", "TAGS": "Commercial & Industrial Property Management", "CREATED_AT": "2008-08-28 10:49:15", "UPDATED_AT": "2008-08-28 10:49:15", "HOURS": null, "PHONE": "09 377 4747", "ADDRESS": "18 Heather Street", "ID": 1132373.0, "CATEGORIES": null}}, 
                    {"distance": 87, "type": "Feature", "properties": {"WEBSITE": "http://www.absolutesound.co.nz", "NAME": "Absolute Sound", "TAGS": "Custom home theatre and audio installers", "CREATED_AT": "2007-03-13 12:46:02", "UPDATED_AT": "2007-03-13 12:46:02", "HOURS": null, "PHONE": "(09) 307 0898", "ADDRESS": "75 Parnell Rise, Parnell, Auckland", "ID": 1094926.0, "CATEGORIES": "Store"}}, 
                    {"distance": 87, "type": "Feature", "properties": {"WEBSITE": "http://www.audiovisualsolutions.co.nz", "NAME": "Audio Visual Solutions Ltd", "TAGS": null, "CREATED_AT": "2007-03-13 12:46:18", "UPDATED_AT": "2007-03-13 12:46:18", "HOURS": null, "PHONE": "(09) 302 2271", "ADDRESS": "75 Parnell Rise, Parnell, Auckland", "ID": 1094953.0, "CATEGORIES": null}}, 
                    {"distance": 87, "type": "Feature", "properties": {"WEBSITE": "http://www.petergilbert.com", "NAME": "Peter Gilbert Ltd", "TAGS": null, "CREATED_AT": "2007-07-06 14:23:33", "UPDATED_AT": "2007-07-06 14:23:33", "HOURS": null, "PHONE": "09 302 2271", "ADDRESS": "75 Parnell Rise, Parnell, Auckland", "ID": 1111467.0, "CATEGORIES": null}}, 
                    {"distance": 105, "type": "Feature", "properties": {"WEBSITE": "http://www.stagecoach.co.nz/thelink/", "NAME": "Link Bus - Parnell bus stop:  Fraser Park  (to Newmarket)", "TAGS": "Link Bus Stagecoach Parnell", "CREATED_AT": "2007-03-12 20:28:07", "UPDATED_AT": "2007-03-12 20:45:14", "HOURS": null, "PHONE": null, "ADDRESS": "89 Parnell Rise", "ID": 1094918.0, "CATEGORIES": "BusStation"}}
                ]
            }
        }
    }
}

Upvotes: 2

Ninja
Ninja

Reputation: 5152

Simplegeo is a well known service for this. Read more about it here: https://simplegeo.com/docs/api-endpoints/simplegeo-places

Upvotes: 0

Pulkit Goyal
Pulkit Goyal

Reputation: 5674

Google provides a Places API that you can use to make such requests. Have a look here to see how to get a list of nearby places.

Upvotes: 1

Related Questions