geo.osmFeatures
Give the features of OpenStreetMap in a box as GeoJSON (the Overpass API), for example the shelters or the roads of a town
CLI- Package
- @procedures/geo · README
- Path
["geo","osmFeatures"]- CLI
mark geo osmFeatures --bbox <object> --selectors <object[]> --userAgent <string>- As data
{"$proc":["geo","osmFeatures"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/geo/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["geo","osmFeatures"], { bbox: {}, selectors: [], userAgent: "<userAgent>" });
console.log(JSON.stringify(result));From the command line
$ mark geo osmFeatures --bbox <object> --selectors <object[]> --userAgent <string>
As data, in a program
{
"$proc": ["geo", "osmFeatures"],
"input": { "bbox": {}, "selectors": [], "userAgent": "<userAgent>" }
}Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
bbox | object | yes | The box (degrees). When west is more than east, the box crosses the antimeridian | |
selectors | object[] | yes | The selectors. An element that one selector selects is in the output | |
userAgent | string | yes | The User-Agent that names your application and a contact. The policies of the public servers require it | |
baseUrl | string | no | Another Overpass server (default: the main public server) | |
timeoutSeconds | integer | no | The time limit of the query on the server, in seconds (default: 60) |
Output
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
collection | object | yes | The features as a GeoJSON feature collection (RFC 7946) | |
skipped | object[] | yes | The elements with no feature or with an incomplete feature, and the reason | |
dataAt | string | no | The time of the OpenStreetMap data of the server | |
attribution | string | yes | The copyright text of the data. A map of the data shows it |
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"bbox": {
"type": "object",
"properties": {
"west": {
"type": "number",
"minimum": -180,
"maximum": 180
},
"south": {
"type": "number",
"minimum": -90,
"maximum": 90
},
"east": {
"type": "number",
"minimum": -180,
"maximum": 180
},
"north": {
"type": "number",
"minimum": -90,
"maximum": 90
}
},
"required": [
"west",
"south",
"east",
"north"
],
"description": "The box (degrees). When west is more than east, the box crosses the antimeridian"
},
"selectors": {
"minItems": 1,
"maxItems": 20,
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"pattern": "^[^\\u0000-\\u001f\\u007f]+$",
"description": "A tag key, for example amenity"
},
"values": {
"description": "The values of the key (default: each value)",
"minItems": 1,
"maxItems": 50,
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"pattern": "^[^\\u0000-\\u001f\\u007f]+$"
}
},
"kinds": {
"description": "The kinds of elements (default: each kind)",
"minItems": 1,
"type": "array",
"items": {
"type": "string",
"enum": [
"node",
"way",
"relation"
]
}
}
},
"required": [
"key"
]
},
"description": "The selectors. An element that one selector selects is in the output"
},
"userAgent": {
"type": "string",
"minLength": 3,
"maxLength": 300,
"pattern": "^[\\x20-\\x7e]+$",
"description": "The User-Agent that names your application and a contact. The policies of the public servers require it"
},
"baseUrl": {
"description": "Another Overpass server (default: the main public server)",
"type": "string",
"format": "uri"
},
"timeoutSeconds": {
"description": "The time limit of the query on the server, in seconds (default: 60)",
"type": "integer",
"minimum": 1,
"maximum": 180
}
},
"required": [
"bbox",
"selectors",
"userAgent"
]
},
"output": {
"type": "object",
"properties": {
"collection": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "FeatureCollection"
},
"features": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "Feature"
},
"id": {
"type": [
"string",
"number"
]
},
"geometry": {
"description": "A GeoJSON geometry, or null"
},
"properties": {
"anyOf": [
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"geometry",
"properties"
],
"additionalProperties": false
}
}
},
"required": [
"type",
"features"
],
"additionalProperties": false,
"description": "The features as a GeoJSON feature collection (RFC 7946)"
},
"skipped": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"reason": {
"type": "string"
}
},
"required": [
"id",
"reason"
],
"additionalProperties": false
},
"description": "The elements with no feature or with an incomplete feature, and the reason"
},
"dataAt": {
"description": "The time of the OpenStreetMap data of the server",
"type": "string"
},
"attribution": {
"type": "string",
"description": "The copyright text of the data. A map of the data shows it"
}
},
"required": [
"collection",
"skipped",
"attribution"
],
"additionalProperties": false
}
}