Use this endpoint to retrieve the names and IDs of geographies (e.g. neighbourhoods, cities) associated with a specific location (lat
/lng
). The geography IDs (e.g. g10_f25dyhcn
) in the returned dictionary can be used to query the Local Profiles, and Scores APIs by geog_id
.
GET v3/geographies
This API uses JWT token based authentication. This JWT Bearer token is what is used to populate the Authorization
header below.
Instructions on how to retrieve this token can be found at Accessing the API → V3 API Authorization.
Header | Status | Description |
---|---|---|
Authorization | required | Your bearer token retrieved from our authorization API, ex. Bearer eyJhbGci... |
Accept | required | The datatype to request, this API will return application/json . |
Parameter | Status | Description |
---|---|---|
lat | required | A decimal number between -90 and 90 (Latitude) |
lng | required | A decimal number between -180 and 180 (Longitude) |
require('node-fetch')('https://api.locallogic.co/v3/geographies?' + new URLSearchParams({lat: 41.847206,lng: -87.668825,}), {method: 'GET',headers: {Accept: 'application/json',Authorization: 'Bearer eyJhbGciOiJ...'}}).then(response => response.json()).then(body => {console.log(body)}).catch(error => {console.log(error)})
{"data": {"type": "geographies","geographies": {"g10_f25dyhcn": {"name": {"fr": "Le Faubourg Saint-Laurent","en": "Le Faubourg Saint-Laurent"},"level_type": {"fr": "quartier","en": "neighbourhood"},"level": 10},"g20_f25dyhf3": {"name": {"en": "Ville-Marie","fr": "Ville-Marie"},"level_type": {"en": "borough","fr": "arrondissement"},"level": 20},"g30_f25dfkes": {"name": {"en": "Montréal","fr": "Montréal"},"level_type": {"en": "city","fr": "ville"},"level": 30}}},"meta": {"order": ["g10_f25dyhcn","g20_f25dyhf3","g30_f25dfkes"]}}
Use this endpoint to retrieve the names and IDs of geographies (e.g. neighbourhoods, cities) associated with a specific location (lat
/lng
). The geography IDs (e.g. g10_f25dyhcn
) in the returned dictionary can be used to query the Local Profiles by geog_id
.
GET v1/geographies
Parameter | Status | Description |
---|---|---|
lat | required | A decimal number between -90 and 90 (Latitude) |
lng | required | A decimal number between -180 and 180 (Longitude) |
key | required | The API Key provided for you |
require('request')({method: 'GET',url: 'https://api.locallogic.co/v1/geographies',qs: {lat: 45.5017,lng: -73.5656,key: 'YOUR_API_KEY'}}, function (err, response, body) {// See response example})
{"data": {"attributes": {"g10_f25dyhcn": {"name": {"fr": "Le Faubourg Saint-Laurent","en": "Le Faubourg Saint-Laurent"},"level_type": {"fr": "quartier","en": "neighbourhood"},"level": 10},"g20_f25dyhf3": {"name": {"en": "Ville-Marie","fr": "Ville-Marie"},"level_type": {"en": "borough","fr": "arrondissement"},"level": 20},"g30_f25dfkes": {"name": {"en": "Montréal","fr": "Montréal"},"level_type": {"en": "city","fr": "ville"},"level": 30}}},"meta": {"order": ["g10_f25dyhcn","g20_f25dyhf3","g30_f25dfkes"]}}