Locations API¶
Location data for districts and blocks, plus GeoJSON boundary overlays for the map. These endpoints are used to populate dropdown menus, build navigation, and render district / protected-area outlines.
The district and block lists are read from the block shapefile (Dist_Name, Block_name). Assam has 35 districts and 220 blocks.
Get Location Hierarchy¶
Returns the district → block hierarchy. Each district also carries a blocks array, and the response includes a flat blocks list for backward compatibility. Districts are sorted alphabetically.
Response¶
{
"districts": [
{
"name": "CACHAR",
"blocks": [
{ "name": "BINNAKANDI (CACHAR)" },
{ "name": "LAKHIPUR (CACHAR)" }
]
},
{
"name": "DIBRUGARH",
"blocks": [
{ "name": "BARBARUAH" },
{ "name": "LAHOWAL" }
]
}
],
"blocks": [
{ "district": "CACHAR", "block_name": "BINNAKANDI (CACHAR)" },
{ "district": "CACHAR", "block_name": "LAKHIPUR (CACHAR)" },
{ "district": "DIBRUGARH", "block_name": "BARBARUAH" }
]
}
| Field | Type | Description |
|---|---|---|
districts |
array | Districts, sorted alphabetically |
districts[].name |
string | District name (from shapefile Dist_Name) |
districts[].blocks |
array | Blocks in this district |
districts[].blocks[].name |
string | Block name |
blocks |
array | Flat list of all blocks with their district (backward compatibility) |
blocks[].district |
string | District name |
blocks[].block_name |
string | Block name |
Errors¶
| Code | Description |
|---|---|
500 |
Server error — returns {"error": "<message>"} |
Example¶
Get All Districts¶
Returns all districts with block counts. Districts are sorted alphabetically.
Response¶
| Field | Type | Description |
|---|---|---|
districts[].name |
string | District name |
districts[].block_count |
integer | Number of blocks in this district |
Errors¶
| Code | Description |
|---|---|
500 |
Server error — returns {"error": "<message>"} |
Example¶
Get District Boundaries¶
Returns district boundary polygons as GeoJSON for map overlay display. These are the dashed outlines shown on the main map.
Response¶
A GeoJSON FeatureCollection of district boundary polygons (structure depends on the source boundary file).
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"dtname": "Tinsukia",
"stname": "Assam"
},
"geometry": {
"type": "Polygon",
"coordinates": [[[95.3, 27.5]]]
}
}
]
}
Errors¶
| Code | Description |
|---|---|
404 |
District boundaries GeoJSON file not available — returns {"error": "District boundaries not available"} |
500 |
Server error — returns {"error": "<message>"} |
Example¶
Get Protected Areas¶
Returns Protected Areas of India (national parks, wildlife sanctuaries, etc.) as a GeoJSON FeatureCollection for map overlay display.
Response¶
A GeoJSON FeatureCollection of protected-area polygons.
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": { "name": "Dibru-Saikhowa National Park" },
"geometry": { "type": "Polygon", "coordinates": [[[95.2, 27.6]]] }
}
]
}
Errors¶
| Code | Description |
|---|---|
404 |
Protected areas data not available — returns {"error": "Protected areas data not available"} |
500 |
Server error — returns {"error": "<message>"} |
Example¶
Get Blocks in a District¶
Returns all blocks belonging to a specific district, sorted alphabetically by block name.
Parameters¶
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
district |
path | string | Yes | District name, matched exactly against Dist_Name (e.g. "TINSUKIA") |
Response¶
{
"district": "TINSUKIA",
"blocks": [
{ "name": "GUIJAN", "district": "TINSUKIA" },
{ "name": "HAPJAN", "district": "TINSUKIA" },
{ "name": "ITAKHULI", "district": "TINSUKIA" }
]
}
| Field | Type | Description |
|---|---|---|
district |
string | The requested district name (echoed back) |
blocks |
array | Blocks in the district, sorted by name |
blocks[].name |
string | Block name |
blocks[].district |
string | District name (echoed for each block) |
Errors¶
| Code | Description |
|---|---|
404 |
District not found — returns {"error": "District \"<name>\" not found"} |
500 |
Server error — returns {"error": "<message>"} |