State boundaries
GET
https://api.ai4mproject.com/v1/boundaries/statesScope: lga_boundariesReturns the outline of every state as a GeoJSON FeatureCollection, for drawing a national map.
Parameters
Section titled “Parameters”None.
Request
Section titled “Request”curl https://api.ai4mproject.com/v1/boundaries/states \ -H "Authorization: Bearer $AI4M_API_KEY"shapes = client.get_state_boundaries()print(len(shapes["features"]), "states")const shapes = await client.getStateBoundaries();console.log(shapes.features.length, "states");shapes, err := client.StateBoundaries(ctx)if err != nil { log.Fatal(err)}fmt.Println(len(shapes["features"].([]any)), "states")Response
Section titled “Response”| Field | Type | Description |
|---|---|---|
type |
string | Always FeatureCollection |
source |
string | Where the shapes come from |
features[].properties.code |
string | Two-letter state code, matching state_code in the risk endpoints |
features[].properties.name |
string | State name |
features[].properties.zone |
string | Zone code: NC, NE, NW, SE, SS or SW |
features[].geometry |
object | A GeoJSON Polygon or MultiPolygon, in longitude and latitude (WGS 84) |
{ "type": "FeatureCollection", "source": "GADM 4.1, simplified", "features": [ { "type": "Feature", "properties": { "code": "AB", "name": "Abia", "zone": "SE" }, "geometry": { "type": "Polygon", "coordinates": [ "…" ] } }, { "type": "Feature", "properties": { "code": "AD", "name": "Adamawa", "zone": "NE" }, "geometry": { "type": "Polygon", "coordinates": [ "…" ] } } ]}The example shows two of the 37 states, with coordinates left out.
Errors
Section titled “Errors”| Code | Status | When |
|---|---|---|
SCOPE_REQUIRED |
403 | The key does not include the scope this endpoint needs |
Any request can also return 401 for a bad key and 429 when a limit is reached. See Errors.