PUT
/
v1
/
osm
/
count

This API is especially useful for gauging the size of extracts before sending to clients (desktop or mobile). Downloading and processing large amounts (10-50MB+) of GeoJSON on mobile or old devices can significantly impact the end user experience.

This endpoint requires the growth plan because it uses thousands of expensive geometric operations.

Body

This request takes a single WKT geometry as the PUT request body (ASCII/UTF8 encoded).

Coordinates are in WGS84 (EPSG:4326) and ordered longitude, latitude. All counted geometries will intersect with the uploaded geometry.

Request Parameters

tags
string
required

All features counted will satisfy each of the passed tags given by this parameter. tags is formatted as a list of tags, each like key=value.

You can create a tag list by forming an array of key=value items and joining them into one string with the & character.

This list must be URL encoded because both = and & are reserved characters in URI.

An example list of tags could be leisure=park and name=Westglen Park. This matches parks that have the name Westglen Park. To set this parameter, we’ll URL encode leisure=park&name=Westglen Park.

Documentation on tags can be found on the TagInfo resource website.

api_key
string
required

Your account’s API key. You can create an API key by registering for an account and copy and paste it from your account dashboard.

Response

When features are successfully counted, a 200 OK response will be issued, with Content-Type: application/json. The body will have a property feature_count which will be an unsigned integer representing the number of features matching the tags and bounding box.

feature_count
number

The number of features matching the filter tags and bounding box.

response_bytes
number

The size of the GeoJSON response, in bytes, that one would get if the same query were used to extract features from OSM inside a polygon.

In the event of an error, an error response will be issued, usually with a 5xx error code. The error will be JSON-formatted, with an error field describing the cause.

error
string

The error message if the extract request parameters were incorrectly formatted.

This response field will not be present if the extract succeeds.

Data License

This API serves OpenStreetMap data, which is freely available and is licensed under the Open Data Commons Open Database License (ODbL).