Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkout hotosm API #5

Closed
2 tasks done
ramyaragupathy opened this issue Mar 26, 2018 · 7 comments
Closed
2 tasks done

Checkout hotosm API #5

ramyaragupathy opened this issue Mar 26, 2018 · 7 comments
Labels

Comments

@ramyaragupathy
Copy link
Owner

ramyaragupathy commented Mar 26, 2018

There's a whole bunch of API functions that could be used to fetch tags and project boundaries. Using this ticket to document useful operations like:

  • Given a project id, fetch the project boundary
  • Given a project id, fetch OpenStreetMap tags for the project
@ramyaragupathy
Copy link
Owner Author

ramyaragupathy commented Mar 27, 2018

Fetch all projects

curl -X GET --header 'Accept: application/json' --header 'Accept-Language: en' 'https://tasks.hotosm.org/api/v1/project/search'

Request url: https://tasks.hotosm.org/api/v1/project/search

Returns centroid of all active mapping projects in mapResults property. Draft & Archived projects not included. Above url returns 1327 results (95 pages with 14 tasks in each page) as on March 27. Similar to https://tasks.hotosm.org/contribute?difficulty=ALL

@ramyaragupathy
Copy link
Owner Author

ramyaragupathy commented Mar 27, 2018

Fetch stats per project

curl -X GET --header 'Accept: application/json' 'https://tasks.hotosm.org/api/v1/stats/project/3597/contributions'

Request url: https://tasks.hotosm.org/api/v1/stats/project/3597

Response:

Fetches a single object with one array property userContributions. This is an array of objects with one object for each mapper pointing to number of blocks mapped/validated by the mapper.

{ "userContributions": [{ "username": "GeoSebbo", "mapped": 1, "validated": 0 }, { "username": "juf Carla", "mapped": 67, "validated": 4 } ........

@ramyaragupathy
Copy link
Owner Author

Fetch all individual tasks in a project

curl -X GET --header 'Accept: application/json' 'https://tasks.hotosm.org/api/v1/project/3597/tasks?as_file=true'

Request url: https://tasks.hotosm.org/api/v1/project/3597/tasks?as_file=true

Returns a geojson file of all tasks

image

@ramyaragupathy
Copy link
Owner Author

ramyaragupathy commented Mar 27, 2018

Fetch boundary/Area of interest for a project

curl -X GET --header 'Accept: application/json' 'https://tasks.hotosm.org/api/v1/project/1/aoi?as_file=true'

Request url: https://tasks.hotosm.org/api/v1/project/3597/aoi?as_file=true

returns a multipolygon boundary with complete individual task boundary
{"type": "MultiPolygon", "coordinates": [[[[16.4285087562573, 8.23085861332612], [16.5603446937389, 8.23119839945904], [16.5630912757697, 8.10681730002128], [16.5630912757697, 8.10307847185412], [16.4305686927802, 8.10341836675953], [16.4285087562573, 8.23085861332612]]]]}

Mexico Earthquake
curl -X GET --header 'Accept: application/json' 'https://tasks.hotosm.org/api/v1/project/3597/aoi?as_file=true' > mexican_earthquake.json

image

@ramyaragupathy
Copy link
Owner Author

ramyaragupathy commented Mar 27, 2018

Fetch description and tag details of a project

Similar to earlier comment, but also fetches description, author, instructions.

curl -X GET --header 'Accept: application/json' --header 'Accept-Language: en' 'https://tasks.hotosm.org/api/v1/project/3597?as_file=false'

Request URL: https://tasks.hotosm.org/api/v1/project/3597?as_file=false

Response: mappingTypes - an array property holds the key

"defaultLocale": "en",
  "projectInfo": {
    "locale": "en",
    "name": "Mexican Earthquake | 2017 Sep 19 - Mexico City - first suburbs affected",
    "shortDescription": "A powerful earthquake (magnitude 7.1) jolted central Mexico on Tuesday, cracking building facades and scattering rubble on streets in the capital on the anniversary of a devastating 1985 quake. Its epicenter was near the Puebla state town of Raboso, about 76 miles southeast of Mexico City.\n\nBut major destructions affected the central city of Mexico. This is the first list of affected zones in this city.",
    "description": "A powerful earthquake (magnitude 7.1) jolted central Mexico on Tuesday 19 September 2017, cracking building facades and scattering rubble on streets in the capital on the anniversary of a devastating 1985 quake.\n\nIts epicenter was near the Puebla state town of Raboso, about 76 miles southeast of Mexico City.\n\nEvent Name: **Puebla Earthquake**\n\nType of Event: Sudden Onset\n\nGeographic Scope: Region (Puebla State, and Mexico City State, in central Mexico)\n\nEstimated Humanitarian Impact: significant casualties are likely (36% chance 100-1000, 34% chance 1000-10000)\n\nEstimated Duration: Medium\n\nNote: part of this HOT project was covered by the older (but still active) [project #1202](https://tasks.hotosm.org/project/1202) in the central Mexico City but with additional goals (including streets and open areas), created in for the National Earthquake Simulation Drill in 2015.",
    "instructions": "Imagery: please use **Esri World Imagery**\r\n\r\nDon't hesitate to subdivide cells if there are too many buildings.\r\n\r\n`Basic roads are mapped, we are mapping buildings`\r\n\r\n**How to contribute:**\r\n\r\n1. Pick a square.\r\n\r\n2. If there is nothing map, add a comment and mark the task as done.\r\n\r\n3. If you see buildings and roads that haven't been traced, please trace them.\r\n\r\n4. Upload your edits by clicking save and mark the task as done.\r\n\r\n5. If you're not done, unlock the task and someone else can complete it.\r\n\r\nUse the \"Split\" link if a task square is too big to finish in 10 mins or so. \r\n\r\nThese are somewhat big task squares because most of the area is lightly populated, but they all have to be checked.\r\n\r\n\r\n\r\n\r\n**Tags to use:**\r\n\r\n**Buildings**\r\n\r\n* building=yes\r\n\r\n**Roads**\r\n\r\n* highway=unclassified (only if you add some of them). Use \"residential\" if you are confident it is, but it could  be also \"pedestrian\" or \"service\" (for public transport). In doubt, use \"unclassified\".\r\n\r\n\r\n**Feature Examples:**\r\n\r\n\r\n**Buildings**\r\n\r\n![alt text](https://github.com/mataharimhairi/images/blob/master/fiji-building-polygon.png?raw=true \"Building\")\r\n\r\n\r\n**Roads**\r\n\r\n![alt text](https://github.com/mataharimhairi/images/blob/master/fiji-road-polyline.png?raw=true \"Road\")\r\n",
    "perTaskInstructions": ""
  },
  "mapperLevel": "INTERMEDIATE",
  "enforceMapperLevel": true,
  "enforceValidatorRole": false,
  "private": false,
  "entitiesToMap": "Buildings only- Solamente edificios",
  "changesetComment": "#hotosm-project-3597 #PueblaEarthquake #MexicoCity #OSMMX",
  "dueDate": null,
  "imagery": "",
  "mappingTypes": [
    "BUILDINGS"
  ],
  "campaignTag": "Disaster Response",
  "organisationTag": "OSM-MX",
  "licenseId": null,
  "allowedUsernames": [],
  "priorityAreas": null,
  "lastUpdated": "2018-03-27T04:52:25.061715",
  "author": "Verdy_p",
  "activeMappers": 0 

However this array might not always hold values: eg: 3722. mappingTypes is a null value

 "defaultLocale": "en",
  "projectInfo": {
    "locale": "en",
    "name": "State of Sri Lankan Cities Project_Galle",
    "shortDescription": "Requesting organization: Sri Lanka Institute of Local Government\r\n\r\n‘The State of Sri Lankan Cities’,focusing nine provincial capitals of Sri Lanka is a publication of UN-Habitat together with relevant ministries and departments of the Government of Sri Lanka.\r\n\r\nThis project is to develop databases and a Report on the State of Sri Lankan Cities.\r\n\r\nBuildings and Landuse data Needed (road details already there)",
    "description": "This project aims to produce a report on Sri Lanka’s cities, entitled State of Sri Lankan Cities 2017 Report. To produce the report, the project will collate information, develop composite maps and databases, and build capacity of the LAs to use the data, which will enable better planning and encourage investment towards a better urban future. The State of Sri Lankan Cities Report will present a well-informed and action-oriented analysis of the state of urbanization of major human settlements across the island.\r\n\r\nEvent name: ‘The State of Sri Lankan Cities’ publication\r\n\r\nImplemented by: United Nations Human Settlements Programme (UN-Habitat)\r\n\r\nPartners: Sri Lanka Institute of Local Governance, UDA, Local Authorities of the 9 Provincial Capitals, Asia Foundation\r\n\r\nDuration: 8 months\r\n\r\nLocation: 9 Provincial Capital Cities in Sri Lanka",
    "instructions": "IMAGERY Please use Bing imagery if you use Digital Globe image please offset it in to Bing\r\n\r\nBUILDINGS Please use building=yes for individual building mapping.\r\n\r\nLANDUSE general information of landuse tagging landuse=greenfield landuse=brownfield landuse=farmland landuse=wetland landuse=forest and ect\r\n\r\nROADS Please map roads as completely as possible by connecting them to the main road networks where ever possible. Very short segments that do not connect to anything should not be mapped. Try and map a little beyond your task square so the person who maps the task square next to yours can easily connect them. Always connect roads to other roads where they meet and never end roads on Residential area polygon edges.\r\n\r\nhighway=primary,secondary - These are major roads that connect large cites and span long distances. Many of these are already mapped, just be sure to map the unclassifieds and residential that run off of the existing mapped roads. ",
    "perTaskInstructions": ""
  },
  "mapperLevel": "BEGINNER",
  "enforceMapperLevel": false,
  "enforceValidatorRole": false,
  "private": false,
  "entitiesToMap": "buildings, land use, and all critical infrastructure",
  "changesetComment": "#hotosm-project-3722#Sri Lanka#Galle#State of Sri Lankan Cities",
  "dueDate": null,
  "imagery": "",
  "mappingTypes": null,
  "campaignTag": "",
  "organisationTag": "",
  "licenseId": null,
  "allowedUsernames": [],
  "priorityAreas": null,
  "lastUpdated": "2018-03-06T08:48:07.947958",
  "author": "maheshika",
  "activeMappers": 0

@ramyaragupathy
Copy link
Owner Author

Mapping types:

This have 5 predetermined values:

What does the end user see? How it is stored internally in Mapping types? OSM tags
Roads ROADS highway = *
Buildings BUILDINGS building = *
Landuse LAND_USE landuse = *
Waterways WATERWAYS waterway = *
Other OTHER n/a

@ramyaragupathy
Copy link
Owner Author

No next actions, items needed work with the url without an authorisation token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant