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.
Tag | Description |
---|---|
all | Return a list of all PoIs |
airport | List of airports |
restaurant | List of restaurants |
bank | List of banks |
atm | List of ATMs |
hotel | List of hotels |
pub | List of pubs |
bus_station | List of bus stations |
railway_station | List of railway stations |
cinema | List of cinema theatres |
hospital | List of hospitals |
college | List of colleges |
school | List of schools |
pharmacy | List of pharmacies |
supermarket | List of supermarket |
fuel | List of fuel stations |
gym | List of gyms |
place_of_worship | List of places of worship |
toilet | List of toilets |
park | List of parks |
stadium | List of stadiums |
parking | List of parking |
cardealer | List 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:
Tag | Description |
---|---|
all | Return a list of all PoIs |
amenity:* | Returns records with amenity class. PoIs such as restaurants, hospitals, banks are returned under the amenity class. |
amenity:school | Returns 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:gym | Returns all records in the amenity class except gym |
!amenity:gym | Returns of all records except elements with amenity as class and gym as type. |
aeroway:aerodrome,tourism:hotel,amenity:parking | Returns a list of airports, hotels and parking spaces nearby. |
Updated about 1 month ago