MENU navbar-image

Introduction

This is the API endpoint and description for all terminaison in the banoc API

This documentation aims to provide all the information you need to work with our API.

Authenticating requests

This API is not authenticated.

Endpoints

Coordinates Geocoding

This method make a reverse geocode, so take longitude and latitude from query string and return the geocode available with the level

Example request:
curl --request GET \
    --get "https://dev.api.banoc.coeurduweb.com/api/geocode/coordinates?latitude=4.015296&longitude=11.557123&level=155" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://dev.api.banoc.coeurduweb.com/api/geocode/coordinates"
);

const params = {
    "latitude": "4.015296",
    "longitude": "11.557123",
    "level": "155",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "gid": 1683577603,
            "jurisd_local_id": 20904,
            "l": 130,
            "code_b32nvu": "FQS3",
            "geom": "0103000020787F000001000000050000000000000070EC274100000000581D1B4100000000B0EC274100000000581D1B4100000000B0EC274100000000D81D1B410000000070EC274100000000D81D1B410000000070EC274100000000581D1B41",
            "centroide": {
                "type": "Point",
                "coordinates": {
                    "lat": 11.557123313,
                    "lon": 4.015295585
                }
            },
            "polygon": {
                "type": "Polygon",
                "coordinates": [
                    [
                        {
                            "lat": 11.556978868,
                            "lon": 4.015151433
                        },
                        {
                            "lat": 11.557266857,
                            "lon": 4.015150528
                        },
                        {
                            "lat": 11.557267758,
                            "lon": 4.015439738
                        },
                        {
                            "lat": 11.556979768,
                            "lon": 4.015440642
                        },
                        {
                            "lat": 11.556978868,
                            "lon": 4.015151433
                        }
                    ]
                ]
            }
        }
    ]
}
 

Example response (404):


{
    "message": "The geocode for latitude : 4.015296 and longitude : 11.557123 not found",
    "error": "NOT_FOUND_GEOCODE",
    "status": 404
}
 

Request      

GET api/geocode/coordinates

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

latitude   number   

The latitude for the geocode. Example: 4.015296

longitude   number   

The longitude for the geocode. Example: 11.557123

level   integer  optional  

The level of the polygon to retrieve. Here are the correspondances of level values :

l (level code) Side length (technical) Side length (rounded, displayed on the application)
180 1 m 1 m
155 5,6 m 5 m
130 32 m 30 m
105 181 m 200 m
80 1024 m 1 km
Example: `155`

Multipoint geocodes

This endpoint is used to make a request with an array of points The return values is an array of the geocode.

Example request:
curl --request POST \
    "https://dev.api.banoc.coeurduweb.com/api/geocode/multi-coordinates" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"points\": [
        {
            \"longitude\": 11.557123,
            \"latitude\": 4.015296
        },
        {
            \"longitude\": -74.006,
            \"latitude\": 40.7128
        }
    ],
    \"level\": 155
}"
const url = new URL(
    "https://dev.api.banoc.coeurduweb.com/api/geocode/multi-coordinates"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "points": [
        {
            "longitude": 11.557123,
            "latitude": 4.015296
        },
        {
            "longitude": -74.006,
            "latitude": 40.7128
        }
    ],
    "level": 155
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
          "point" : {
             "longitude": 11.557123,
             "latitude": 4.015296
           }
          "geocode" : {
              "jurisd_local_id": 20904,
              "code_b32nvu": "FQS3",
              "l": 130,
              "polygon": {
                 "type": "Polygon",
                "coordinates": [
                    [
                        {
                            "lon": "11.557095",
                            "lat": "4.052170"
                        },
                        {
                            "lon": "11.557096",
                            "lat": "4.052459"
                        },
                        {
                            "lon": "11.557384",
                            "lat": "4.052459"
                        },
                        {
                            "lon": "11.557383",
                            "lat": "4.052169"
                        },
                        {
                            "lon": "11.557095",
                            "lat": "4.052170"
                        }
                    ]
                ]
            },
            "centroide": {
                "type": "Point",
                "coordinates": {
                    "lon": "11.557240",
                    "lat": "4.052314"
                }
            },
            "city": {
                "jurisd_local_id": 20904,
                "city": "Soa",
                "iso_label": "CM-SOA",
                "lon": "11.55",
                "lat": "3.95",
                "country_id": 1,
                "created_at": "2024-10-03T14:59:54.000000Z",
                "updated_at": "2024-10-03T14:59:54.000000Z"
            }
        }
      }
    ]
}
 

Example response (404):


{
    "data": [
        {
          "point" : {
             "longitude": 11.557123,
             "latitude": 4.015296
           }
          "geocode" : 404
        }
      }
    ]
}
 

Request      

POST api/geocode/multi-coordinates

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

points   string[]   

An array of points to geocode. Each point should have a latitude and longitude.

*   object  optional  
longitude   number   

The longitude of the point. Example: 11.557123

latitude   number   

The latitude of the point. Example: 4.015296

level   integer  optional  

The level of the polygon to retrieve. Here are the correspondances of level values. An example of JSON request into the server

Example: `155`

Geocoding from Banoc Code

This method make a search with banoc code, full or short and the jurisd_local_id that we need to check the city of the banoc code

Example request:
curl --request GET \
    --get "https://dev.api.banoc.coeurduweb.com/api/geocode/code/FQS3/20904" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://dev.api.banoc.coeurduweb.com/api/geocode/code/FQS3/20904"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "jurisd_local_id": 20904,
            "code_b32nvu": "FQS3",
            "l": 130,
            "polygon": {
                "type": "Polygon",
                "coordinates": [
                    [
                        {
                            "lon": "11.557095",
                            "lat": "4.052170"
                        },
                        {
                            "lon": "11.557096",
                            "lat": "4.052459"
                        },
                        {
                            "lon": "11.557384",
                            "lat": "4.052459"
                        },
                        {
                            "lon": "11.557383",
                            "lat": "4.052169"
                        },
                        {
                            "lon": "11.557095",
                            "lat": "4.052170"
                        }
                    ]
                ]
            },
            "centroide": {
                "type": "Point",
                "coordinates": {
                    "lon": "11.557240",
                    "lat": "4.052314"
                }
            },
            "city": {
                "jurisd_local_id": 20904,
                "city": "Soa",
                "iso_label": "CM-SOA",
                "lon": "11.55",
                "lat": "3.95",
                "country_id": 1,
                "created_at": "2024-10-03T14:59:54.000000Z",
                "updated_at": "2024-10-03T14:59:54.000000Z"
            }
        }
    ]
}
 

Example response (404):


{
"message": "The geocode from code "FQS3" is not found",
 "error": "NOT_FOUND_GEOCODE",
  "status": 404
}
 

Request      

GET api/geocode/code/{code}/{jurisd_local_id?}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

code   string  optional  

The banoc code, full or short. Example: FQS3

jurisd_local_id   number  optional  

The jurisd_lolal_id for the city. Example: 20904

All occurence

API for returning all possible results, from BANOC Code, Nominatim or City lists

Example request:
curl --request GET \
    --get "https://dev.api.banoc.coeurduweb.com/api/geocode/all?q=SOA&format=city%2Cbanoc&jurisd_local_id=20904" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://dev.api.banoc.coeurduweb.com/api/geocode/all"
);

const params = {
    "q": "SOA",
    "format": "city,banoc",
    "jurisd_local_id": "20904",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "cities": [
        {
            "jurisd_local_id": 20904,
            "city": "Soa",
            "iso_label": "CM-SOA",
            "lon": "11.55",
            "lat": "3.95",
            "country_id": 1,
            "created_at": "2024-10-03T14:59:54.000000Z",
            "updated_at": "2024-10-03T14:59:54.000000Z",
            "l": 80,
            "country": {
                "id": 1,
                "name": "Cameroun",
                "created_at": "2024-09-06T13:58:23.000000Z",
                "updated_at": "2024-09-06T13:58:23.000000Z"
            }
        }
    ],
    "banoc_codes": []
}
 

Request      

GET api/geocode/all

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

q   string   

The query to search. Example: SOA

format   string  optional  

List of the format needed, possible value are full,banoc,city,address. Default to full. Example: city,banoc

jurisd_local_id   integer  optional  

The jurisd_local_id for the city, we need it if we make request with banoc format. Example: 20904