Raw Data API 1
Servers
Description | URL |
---|---|
/latest | /latest |
Endpoints
GET /status/
Check Database Last Updated
Description
Gives status about how recent the osm data is , it will give the last time that database was updated completely
Response 200 OK
{
"lastUpdated": "2022-06-27 19:59:24+05:45"
}
Schema of the response body
{
"title": "StatusResponse",
"required": [
"lastUpdated"
],
"type": "object",
"properties": {
"lastUpdated": {
"title": "Lastupdated",
"type": "string"
}
},
"additionalProperties": false,
"example": {
"lastUpdated": "2022-06-27 19:59:24+05:45"
}
}
POST /snapshot/
Get Osm Current Snapshot As File
Description
Generates the current raw OpenStreetMap data available on database based on the input geometry, query and spatial features.
Steps to Run Snapshot :
- Post the your request here and your request will be on queue, endpoint will return as following : { "task_id": "your task_id", "track_link": "/tasks/task_id/" }
- Now navigate to /tasks/ with your task id to track progress and result
Request body
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
83.96919250488281,
28.194446860487773
],
[
83.99751663208006,
28.194446860487773
],
[
83.99751663208006,
28.214869548073377
],
[
83.96919250488281,
28.214869548073377
],
[
83.96919250488281,
28.194446860487773
]
]
]
}
}
{
"outputType": "shp",
"fileName": "Pokhara_all_features",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
83.96919250488281,
28.194446860487773
],
[
83.99751663208006,
28.194446860487773
],
[
83.99751663208006,
28.214869548073377
],
[
83.96919250488281,
28.214869548073377
],
[
83.96919250488281,
28.194446860487773
]
]
]
}
}
{
"outputType": "geojson",
"fileName": "Pokhara_buildings",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
83.96919250488281,
28.194446860487773
],
[
83.99751663208006,
28.194446860487773
],
[
83.99751663208006,
28.214869548073377
],
[
83.96919250488281,
28.214869548073377
],
[
83.96919250488281,
28.194446860487773
]
]
]
},
"filters": {
"tags": {
"all_geometry": {
"building": []
}
},
"attributes": {
"all_geometry": [
"name"
]
}
},
"geometryType": [
"point",
"polygon"
]
}
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
83.585701,
28.046607
],
[
83.585701,
28.382561
],
[
84.391823,
28.382561
],
[
84.391823,
28.046607
],
[
83.585701,
28.046607
]
]
]
},
"fileName": "my export",
"outputType": "geojson",
"geometryType": [
"point",
"polygon"
],
"filters": {
"tags": {
"all_geometry": {
"building": [],
"amenity": [
"cafe",
"restaurant",
"pub"
]
}
},
"attributes": {
"all_geometry": [
"name",
"addr"
]
}
},
"joinFilterType": "OR"
}
{
"fileName": "Example export with all features",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
83.585701,
28.046607
],
[
83.585701,
28.382561
],
[
84.391823,
28.382561
],
[
84.391823,
28.046607
],
[
83.585701,
28.046607
]
]
]
},
"outputType": "geojson",
"geometryType": [
"point",
"line",
"polygon"
],
"filters": {
"tags": {
"point": {
"amenity": [
"bank",
"ferry_terminal",
"bus_station",
"fuel",
"kindergarten",
"school",
"college",
"university",
"place_of_worship",
"marketplace",
"clinic",
"hospital",
"police",
"fire_station"
],
"building": [
"bank",
"aerodrome",
"ferry_terminal",
"train_station",
"bus_station",
"pumping_station",
"power_substation",
"kindergarten",
"school",
"college",
"university",
"mosque ",
" church ",
" temple",
"supermarket",
"marketplace",
"clinic",
"hospital",
"police",
"fire_station",
"stadium ",
" sports_centre",
"governor_office ",
" townhall ",
" subdistrict_office ",
" village_office ",
" community_group_office",
"government_office"
],
"man_made": [
"tower",
"water_tower",
"pumping_station"
],
"tower:type": [
"communication"
],
"aeroway": [
"aerodrome"
],
"railway": [
"station"
],
"emergency": [
"fire_hydrant"
],
"landuse": [
"reservoir",
"recreation_gound"
],
"waterway": [
"floodgate"
],
"natural": [
"spring"
],
"power": [
"tower",
"substation"
],
"shop": [
"supermarket"
],
"leisure": [
"stadium ",
" sports_centre ",
" pitch ",
" swimming_pool",
"park"
],
"office": [
"government"
]
},
"line": {
"highway": [
"motorway ",
" trunk ",
" primary ",
" secondary ",
" tertiary ",
" service ",
" residential ",
" pedestrian ",
" path ",
" living_street ",
" track"
],
"railway": [
"rail"
],
"man_made": [
"embankment"
],
"waterway": []
},
"polygon": {
"amenity": [
"bank",
"ferry_terminal",
"bus_station",
"fuel",
"kindergarten",
"school",
"college",
"university",
"place_of_worship",
"marketplace",
"clinic",
"hospital",
"police",
"fire_station"
],
"building": [
"bank",
"aerodrome",
"ferry_terminal",
"train_station",
"bus_station",
"pumping_station",
"power_substation",
"power_plant",
"kindergarten",
"school",
"college",
"university",
"mosque ",
" church ",
" temple",
"supermarket",
"marketplace",
"clinic",
"hospital",
"police",
"fire_station",
"stadium ",
" sports_centre",
"governor_office ",
" townhall ",
" subdistrict_office ",
" village_office ",
" community_group_office",
"government_office"
],
"man_made": [
"tower",
"water_tower",
"pumping_station"
],
"tower:type": [
"communication"
],
"aeroway": [
"aerodrome"
],
"railway": [
"station"
],
"landuse": [
"reservoir",
"recreation_gound"
],
"waterway": [],
"natural": [
"spring"
],
"power": [
"substation",
"plant"
],
"shop": [
"supermarket"
],
"leisure": [
"stadium ",
" sports_centre ",
" pitch ",
" swimming_pool",
"park"
],
"office": [
"government"
],
"type": [
"boundary"
],
"boundary": [
"administrative"
]
}
},
"attributes": {
"point": [
"building",
"ground_floor:height",
"capacity:persons",
"building:structure",
"building:condition",
"name",
"admin_level",
"building:material",
"office",
"building:roof",
"backup_generator",
"access:roof",
"building:levels",
"building:floor",
"addr:full",
"addr:city",
"source"
],
"line": [
"width",
"source",
"waterway",
"name"
],
"polygon": [
"landslide_prone",
"name",
"admin_level",
"type",
"is_in:town",
"flood_prone",
"is_in:province",
"is_in:city",
"is_in:municipality",
"is_in:RW",
"is_in:village",
"source",
"boundary"
]
}
}
}
Schema of the request body
{
"title": "Params",
"allOf": [
{
"$ref": "#/components/schemas/RawDataCurrentParams"
}
],
"default": {}
}
Response 200 OK
{
"task_id": "aa539af6-83d4-4aa3-879e-abf14fffa03f",
"track_link": "/tasks/status/aa539af6-83d4-4aa3-879e-abf14fffa03f/"
}
Schema of the response body
{
"title": "SnapshotResponse",
"required": [
"taskId",
"trackLink"
],
"type": "object",
"properties": {
"taskId": {
"title": "Taskid",
"type": "string"
},
"trackLink": {
"title": "Tracklink",
"type": "string"
}
},
"additionalProperties": false,
"example": {
"task_id": "aa539af6-83d4-4aa3-879e-abf14fffa03f",
"track_link": "/tasks/status/aa539af6-83d4-4aa3-879e-abf14fffa03f/"
}
}
Response 422 Unprocessable Entity
{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}
Schema of the response body
{
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationError"
}
}
}
}
POST /snapshot/plain/
Get Current Snapshot As Plain Geojson
Description
Simple API to get osm features as geojson for small region. This is designed only for querying small data for large data follow /snapshot/
Params ::
bbox: Optional List = takes xmin, ymin, xmax, ymax uses srid=4326
select: List = this is select query you can pass [*] to select all
attribute where: List[WhereCondition] = [{'key': 'building', 'value': ['*']},{'key':'amenity','value':['school','college']}] join_by: Optional[JoinFilterType] = or/ and look_in: Optional[List[OsmFeatureType]] = ["nodes", "ways_poly","ways_line","relations"] : tables name
Request body
{
"select": [
"name"
],
"where": [
{
"key": "admin_level",
"value": [
"2"
]
},
{
"key": "boundary",
"value": [
"administrative"
]
},
{
"key": "name:en",
"value": [
"Nepal"
]
}
],
"joinBy": "AND",
"lookIn": [
"relations"
]
}
{
"select": [
"name"
],
"where": [
{
"key": "admin_level",
"value": [
"7"
]
},
{
"key": "boundary",
"value": [
"administrative"
]
},
{
"key": "name",
"value": [
"Pokhara"
]
}
],
"joinBy": "AND",
"lookIn": [
"relations"
]
}
Schema of the request body
{
"title": "Params",
"allOf": [
{
"$ref": "#/components/schemas/SnapshotParamsPlain"
}
],
"default": {}
}
Response 200 OK
Schema of the response body
{
"title": "Response Get Current Snapshot As Plain Geojson Snapshot Plain Post",
"type": "object"
}
Response 422 Unprocessable Entity
{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}
Schema of the response body
{
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationError"
}
}
}
}
GET /tasks/status/{task_id}/
Get Task Status
Description
Tracks the request from the task id provided by Raw Data API for the request
Args:
task_id ([type]): [Unique id provided on response from /snapshot/]
Returns:
id: Id of the task
status : SUCCESS / PENDING
result : Result of task
Successful task will have additional nested json inside
Input parameters
Parameter | In | Type | Default | Nullable | Description |
---|---|---|---|---|---|
task_id |
path | None | No |
Response 200 OK
{
"id": "3fded368-456f-4ef4-a1b8-c099a7f77ca4",
"status": "SUCCESS",
"result": {
"download_url": "https://s3.us-east-1.amazonaws.com/exports-stage.hotosm.org/Raw_Export_3fded368-456f-4ef4-a1b8-c099a7f77ca4_GeoJSON.zip",
"file_name": "Raw_Export_3fded368-456f-4ef4-a1b8-c099a7f77ca4_GeoJSON",
"response_time": "0:00:12.175976",
"query_area": "6 Sq Km ",
"binded_file_size": "7 MB",
"zip_file_size_bytes": 1331601
}
}
Schema of the response body
{
"title": "SnapshotTaskResponse",
"required": [
"id",
"status",
"result"
],
"type": "object",
"properties": {
"id": {
"title": "Id",
"type": "string"
},
"status": {
"title": "Status",
"type": "string"
},
"result": {
"$ref": "#/components/schemas/SnapshotTaskResult"
}
},
"additionalProperties": false,
"example": {
"id": "3fded368-456f-4ef4-a1b8-c099a7f77ca4",
"status": "SUCCESS",
"result": {
"download_url": "https://s3.us-east-1.amazonaws.com/exports-stage.hotosm.org/Raw_Export_3fded368-456f-4ef4-a1b8-c099a7f77ca4_GeoJSON.zip",
"file_name": "Raw_Export_3fded368-456f-4ef4-a1b8-c099a7f77ca4_GeoJSON",
"response_time": "0:00:12.175976",
"query_area": "6 Sq Km ",
"binded_file_size": "7 MB",
"zip_file_size_bytes": 1331601
}
}
}
Response 422 Unprocessable Entity
{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}
Schema of the response body
{
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationError"
}
}
}
}
Schemas
AttributeFilter
Name | Type |
---|---|
allGeometry |
Array<string> |
line |
Array<string> |
point |
Array<string> |
polygon |
Array<string> |
Filters
Name | Type |
---|---|
attributes |
AttributeFilter |
tags |
TagsFilter |
HTTPValidationError
Name | Type |
---|---|
detail |
Array<ValidationError> |
JoinFilterType
Type:
MultiPolygon
Name | Type |
---|---|
coordinates |
Array<Array<Array<>>> |
type |
string |
OsmFeatureType
Type:
Polygon
Name | Type |
---|---|
coordinates |
Array<Array<>> |
type |
string |
RawDataCurrentParams
Name | Type |
---|---|
countryExport |
boolean |
fileName |
string |
filters |
|
geometry |
|
geometryType |
Array<SupportedGeometryFilters> |
joinFilterType |
|
maxZoom |
integer |
minZoom |
integer |
outputType |
RawDataOutputType
Type:
SnapshotParamsPlain
Name | Type |
---|---|
bbox |
|
geometryType |
SupportedGeometryFilters |
joinBy |
|
lookIn |
Array<OsmFeatureType> |
select |
Array<string> |
where |
Array<WhereCondition> |
SnapshotResponse
Name | Type |
---|---|
taskId |
string |
trackLink |
string |
SnapshotTaskResponse
Name | Type |
---|---|
id |
string |
result |
SnapshotTaskResult |
status |
string |
SnapshotTaskResult
Name | Type |
---|---|
bindedFileSize |
string |
downloadUrl |
string |
fileName |
string |
queryArea |
string |
responseTime |
string |
zipFileSizeBytes |
integer |
StatusResponse
Name | Type |
---|---|
lastUpdated |
string |
SupportedGeometryFilters
Type:
TagsFilter
Name | Type |
---|---|
allGeometry |
|
line |
|
point |
|
polygon |
ValidationError
Name | Type |
---|---|
loc |
Array<string> |
msg |
string |
type |
string |
WhereCondition
Name | Type |
---|---|
key |
string |
value |
Array<string> |