POI Tags

You can use a tag to restrict your results on the Nearby API. We support two types of tags, a single-word format for common use-cases and key-value pairs for advanced use-cases.

1. Single-word Format (Simple)

The below example lists schools within 1000 meters

<?php

$curl = curl_init('https://us1.locationiq.com/v1/nearby?key=YOUR_ACCESS_TOKEN&lat=-37.870983&lon=144.980714&tag=school&radius=1000&format=json');

curl_setopt_array($curl, array(
  CURLOPT_RETURNTRANSFER    =>  true,
  CURLOPT_FOLLOWLOCATION    =>  true,
  CURLOPT_MAXREDIRS         =>  10,
  CURLOPT_TIMEOUT           =>  30,
  CURLOPT_CUSTOMREQUEST     =>  'GET',
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import requests

url = "https://us1.locationiq.com/v1/nearby"

data = {
    'key': 'YOUR_ACCESS_TOKEN',
    'lat': '-37.870983',
    'lon': '144.980714',
    'tag': 'school',
    'radius': 1000,
    'format': 'json'
}

response = requests.get(url, params=data)

print(response.text)
curl --request GET \
  --url 'https://us1.locationiq.com/v1/nearby?key=YOUR_ACCESS_TOKEN&lat=-37.870983&lon=144.980714&tag=school&radius=1000&format=json'
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://us1.locationiq.com/v1/nearby?key=YOUR_ACCESS_TOKEN&lat=-37.870983&lon=144.980714&tag=school&radius=1000&format=json",
  "method": "GET"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

The above command returns JSON structured like this:

[
  {
    "place_id": "422634715054",
    "osm_type": "way",
    "osm_id": "27695264",
    "lat": "-37.86973755",
    "lon": "144.98925509",
    "class": "amenity",
    "type": "school",
    "tag_type": "school",
    "name": "St Kilda Primary School",
    "display_name": "St Kilda Primary School, Nightingale Street, St Kilda, Balaclava, Melbourne, 3182, Australia",
    "address": {
        "name": "St Kilda Primary School",
        "road": "Nightingale Street",
        "suburb": "St Kilda",
        "city": "Balaclava",
        "state": "Melbourne",
        "postcode": "3182",
        "country": "Australia",
        "country_code": "au"
    },
    "boundingbox": [
        "-37.8705392",
        "-37.8688718",
        "144.9882414",
        "144.9901112"
    ],
    "distance": 762
  }
]

For most use-cases, the list of tags below should suffice. Multiple tags can be specified as a comma-separated list.

TagDescription
allReturn a list of all PoIs
airportList of airports
restaurantList of restaurants
bankList of banks
atmList of ATMs
hotelList of hotels
pubList of pubs
bus_stationList of bus stations
railway_stationList of railway stations
cinemaList of cinema theatres
hospitalList of hospitals
collegeList of colleges
schoolList of schools
pharmacyList of pharmacies
supermarketList of supermarket
fuelList of fuel stations
gymList of gyms
place_of_worshipList of places of worship
toiletList of toilets
parkList of parks
stadiumList of stadiums
parkingList of parking
cardealerList of car dealers

2. Key Value Format (Advanced)

The below example lists all records of tourism class within 50 meters

<?php

$curl = curl_init('https://us1.locationiq.com/v1/nearby?key=YOUR_ACCESS_TOKEN&lat=40.748428&lon=-73.985654&tag=tourism:*&radius=50&format=json');

curl_setopt_array($curl, array(
  CURLOPT_RETURNTRANSFER    =>  true,
  CURLOPT_FOLLOWLOCATION    =>  true,
  CURLOPT_MAXREDIRS         =>  10,
  CURLOPT_TIMEOUT           =>  30,
  CURLOPT_CUSTOMREQUEST     =>  'GET',
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import requests

url = "https://us1.locationiq.com/v1/nearby"

data = {
    'key': 'YOUR_ACCESS_TOKEN',
    'lat': '40.748428',
    'lon': '-73.985654',
    'tag': 'tourism:*',
    'radius': 50,
    'format': 'json'
}

response = requests.get(url, params=data)

print(response.text)
curl --request GET \
  --url 'https://us1.locationiq.com/v1/nearby?key=YOUR_ACCESS_TOKEN&lat=40.748428&lon=-73.985654&tag=tourism:*&radius=50&format=json'
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://us1.locationiq.com/v1/nearby?key=YOUR_ACCESS_TOKEN&lat=40.748428&lon=-73.985654&tag=tourism:*&radius=50&format=json",
  "method": "GET"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

The above command returns JSON structured like this:

[
  {
    "place_id": "423028398818",
    "osm_type": "way",
    "osm_id": "34633854",
    "lat": "40.7484284",
    "lon": "-73.98565462",
    "class": "tourism",
    "type": "attraction",
    "tag_type": "attraction",
    "name": "Empire State Building",
    "display_name": "Empire State Building, 350, 5th Avenue, Korea Town, Midtown South, New York, New York, 10001, United States of America",
    "address": {
        "name": "Empire State Building",
        "house_number": "350",
        "road": "5th Avenue",
        "neighbourhood": "Korea Town",
        "suburb": "Midtown South",
        "city": "New York",
        "state": "New York",
        "postcode": "10001",
        "country": "United States of America",
        "country_code": "us"
    },
    "boundingbox": [
        "40.7479226",
        "40.7489422",
        "-73.9864855",
        "-73.9848259"
    ],
    "distance": 1
  },
  {
    "place_id": "423629875658",
    "osm_type": "node",
    "osm_id": "5190610589",
    "lat": "40.7483271",
    "lon": "-73.9856549",
    "class": "tourism",
    "type": "attraction",
    "tag_type": "attraction",
    "name": "NY Skyride",
    "display_name": "NY Skyride, 350, 5th Avenue, Korea Town, Midtown South, New York, New York, 10001, United States of America",
    "address": {
        "name": "NY Skyride",
        "house_number": "350",
        "road": "5th Avenue",
        "neighbourhood": "Korea Town",
        "suburb": "Midtown South",
        "city": "New York",
        "state": "New York",
        "postcode": "10001",
        "country": "United States of America",
        "country_code": "us"
    },
    "boundingbox": [
        "40.7483271",
        "40.7483271",
        "-73.9856549",
        "-73.9856549"
    ],
    "distance": 9
  }
]

For advanced use-cases that need additional tags not present in the table above, we also support tags based on OpenStreetMap's (OSM) exhaustive list of tags. These tags are represented as key-value pairs of class and type values. Multiple class and type values can be specified as a comma-separated list.

Examples:

TagDescription
allReturn a list of all PoIs
amenity:*Returns records with amenity class. PoIs such as restaurants, hospitals, banks are returned under the amenity class.
amenity:schoolReturns records with the amenity class and school as type, i.e. a list of schools.
all,!amenity:*Returns all records except those with amenity as class
amenity:*,!amenity:gymReturns all records in the amenity class except gym
!amenity:gymReturns of all records except elements with amenity as class and gym as type.
aeroway:aerodrome,tourism:hotel,amenity:parkingReturns a list of airports, hotels and parking spaces nearby.