openstreetmap@1.0.0 
This adaptor exports the following from common:
- as()
- combine()
- cursor()
- dataPath()
- dataValue()
- dateFns
- each()
- field()
- fields()
- fn()
- fnIf()
- group()
- lastReferenceValue()
- map()
- merge()
- scrubEmojis()
- sourceValue()
- util
- combine()
Functions
listFeatures
listFeatures(filter, [options]) ⇒ Operation
List OpenStreetMap features which match some tags inside an area or bounding box,
as a GeoJSON FeatureCollection.
Every feature is a Point: ways and relations use the center of their bounding box.
Feature properties are the OpenStreetMap tags plus @id, @version and @timestamp.
The collection's timestamp is the time of the OpenStreetMap data Overpass searched,
which can be used as the next changedSince.
| Param | Type | Description |
|---|---|---|
| filter | FeatureFilter | Which features to fetch |
| [options] | QueryOptions | Optional query options |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | a GeoJSON FeatureCollection |
Example: List the schools in a region
listFeatures({
tags: { amenity: 'school' },
area: { 'ISO3166-2': $.data.regionCode },
});
Example: List libraries, community centres and parks in a bounding box
listFeatures({
tags: [{ amenity: ['library', 'community_centre'] }, { leisure: 'park' }],
bbox: $.data.bbox,
});
Example: List shops changed since the last run
listFeatures({
tags: { shop: '*' },
area: { name: 'Example District', admin_level: '6' },
changedSince: $.lastRunTimestamp,
});
query
query(overpassQL, [options]) ⇒ Operation
Run an Overpass QL query and write the matching OpenStreetMap elements to
state.data. The adaptor adds the [out:json][timeout:N] settings, so don't
include them in the query. See the
Overpass QL docs.
| Param | Type | Description |
|---|---|---|
| overpassQL | string | The Overpass QL query to run |
| [options] | QueryOptions | Optional query options |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | an array of OpenStreetMap elements |
Example: Fetch the schools inside a bounding box
query('nwr["amenity"="school"](51.47,-0.15,51.52,-0.05); out center;');
Example: Allow a slow query to run for up to 10 minutes
query($.data.overpassQuery, { queryTimeoutSeconds: 600 });
request
request(method, path, body, [options]) ⇒ Operation
Make a general HTTP request to an Overpass API instance
| Param | Type | Description |
|---|---|---|
| method | string | HTTP method to use |
| path | string | Path to resource, relative to the configured baseUrl |
| body | object | Object which will be attached to the request body |
| [options] | RequestOptions | Optional request options |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response body |
| response | the response from the HTTP server, including headers, statusCode, body, etc |
| references | an array of all previous data objects used in the Job |
Example: Check the rate limit status of the Overpass instance
request('GET', 'status');
Interfaces
FeatureFilter
Which features to fetch. area or bbox is required.
Properties
| Name | Type | Description |
|---|---|---|
| tags | object | Array.<object> | Tags to match. In an object, every tag must match. In an array of objects, any object may match. Values are a string, an array of strings (any of them), or '*' (any value). |
| area | object | Tags identifying the area to search inside, ie { 'ISO3166-2': 'XX-YY' } or { name: 'Example', admin_level: '4' } |
| bbox | object | Bounding box to search inside, as { south, west, north, east } in decimal degrees |
| changedSince | string | Only return features created or modified after this date. Deleted features are not reported. |
HttpState
State object
Properties
| Name | Description |
|---|---|
| data | the parsed response body |
| response | the response from the HTTP server, including headers, statusCode, body, etc |
| references | an array of all previous data objects used in the Job |
QueryOptions
Options for running an Overpass query
Properties
| Name | Type | Description |
|---|---|---|
| queryTimeoutSeconds | number | The longest Overpass may run the query, in seconds, sent as [timeout:N]. Default: 180. |
RequestOptions
Options provided to the HTTP request
Properties
| Name | Type | Description |
|---|---|---|
| errors | object | Map of errorCodes -> error messages, ie, { 404: 'Resource not found;' }. Pass false to suppress errors for this code. |
| query | object | An object of query parameters to be encoded into the URL. |
| headers | object | An object of headers to append to the request. |
| parseAs | string | Parse the response body as json, text or stream. By default will use the response headers. |
| timeoutMs | number | How long to wait for a response, in milliseconds. Default: 300000 (5 minutes). |