curl --request GET \
--url https://api.loci.ng/v1/frames \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.loci.ng/v1/frames"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.loci.ng/v1/frames', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.loci.ng/v1/frames",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.loci.ng/v1/frames"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.loci.ng/v1/frames")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.loci.ng/v1/frames")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "2163725",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
7.4904,
9.05143
],
[
7.4805,
9.05143
],
[
7.4805,
9.06201
],
[
7.4904,
9.06201
],
[
7.4904,
9.05143
]
]
]
}
},
{
"type": "Feature",
"id": "2163731",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
7.4904,
9.04434
],
[
7.48158,
9.04434
],
[
7.48158,
9.05143
],
[
7.4904,
9.05143
],
[
7.4904,
9.04434
]
]
]
}
},
{
"type": "Feature",
"id": "2163732",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
7.49509,
9.04434
],
[
7.4904,
9.04434
],
[
7.4904,
9.05143
],
[
7.49509,
9.05143
],
[
7.49509,
9.04434
]
]
]
}
}
],
"truncated": true
}
}The frames around a location, or of an administrative unit
Frames as a GeoJSON FeatureCollection carrying each frame’s id and shape, chosen one of three ways.
By box. Every frame that touches bbox. To get the frames around a point, build a box around it. The grid is roughly 0.01° across, so a box of ±0.01° around a location returns the frame it is in and its neighbours; ±0.05° returns a neighbourhood. The box is minLon,minLat,maxLon,maxLat in degrees, GeoJSON axis order.
By administrative unit. Every frame in a state, an LGA or a ward, named down the hierarchy: state=, state=&lga=, or state=&lga=&ward=, matched regardless of case. Each level needs the ones above it, because LGA and ward names repeat across the country. The names come from GET /v1/states, /v1/lgas and /v1/wards, or from GET /v1/frames/admin.
By id. ids fetches up to 100 named frames in full, bounding boxes included, and answers with an array of frames rather than a collection.
At most 5,000 frames come back in one response, or fewer with limit. A box past that says so with "truncated": true rather than failing, and the remedy is a smaller box. A unit past that is paged: the response also carries next, and sending it back as after= returns the following page, in frame-id order, until a page comes without one. Every state is more than one page, and so are the largest LGAs; a ward is one or two.
Needs frame.read.
curl --request GET \
--url https://api.loci.ng/v1/frames \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.loci.ng/v1/frames"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.loci.ng/v1/frames', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.loci.ng/v1/frames",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.loci.ng/v1/frames"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.loci.ng/v1/frames")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.loci.ng/v1/frames")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "2163725",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
7.4904,
9.05143
],
[
7.4805,
9.05143
],
[
7.4805,
9.06201
],
[
7.4904,
9.06201
],
[
7.4904,
9.05143
]
]
]
}
},
{
"type": "Feature",
"id": "2163731",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
7.4904,
9.04434
],
[
7.48158,
9.04434
],
[
7.48158,
9.05143
],
[
7.4904,
9.05143
],
[
7.4904,
9.04434
]
]
]
}
},
{
"type": "Feature",
"id": "2163732",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
7.49509,
9.04434
],
[
7.4904,
9.04434
],
[
7.4904,
9.05143
],
[
7.49509,
9.05143
],
[
7.49509,
9.04434
]
]
]
}
}
],
"truncated": true
}
}Authorizations
An API key minted in the Developers tab of the LOCI app, sent as Authorization: Bearer loci_sk_…. Acts for one organisation, is read-only, and expires.
Query Parameters
minLon,minLat,maxLon,maxLat in degrees. One of bbox, an administrative selector, or ids is required.
A state by name, matched regardless of case.
A local government area by name, matched regardless of case. Needs state: LGA names repeat across states.
A ward by name, matched regardless of case. Needs state and lga.
At most this many frames per response, up to 5,000, which is also the default.
1 <= x <= 5000The next value of the previous page of an administrative unit, to continue the walk. Only with state, lga and ward; a box is not paged.
Instead of bbox: comma-separated frame ids, at most 100. Returns full frames with bounding boxes.
Response
The frames in the box or the unit as a FeatureCollection, or, with ids, an array of frames. Empty when nothing matches.
- object
- object[]
Show child attributes
Show child attributes