hotosm / galaxy-api

Backend to fetch data from Underpass
https://galaxy-api.hotosm.org/latest/redoc
GNU Affero General Public License v3.0
14 stars 5 forks source link

Acceptance Criteria for Current snapshot #167

Closed kshitijrajsharma closed 2 years ago

kshitijrajsharma commented 2 years ago

An API endpoint, where the user can extract a certain OSM feature type and geometry type within the input polygon

Endpoint: /rawdata/current-snapshot/ POST Authenticated through OSM login

Source: Underpass

Sample Request Body:

{
  "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              71.08154296875,
              34.125447565116126
            ],
            [
              71.83959960937499,
              34.125447565116126
            ],
            [
              71.83959960937499,
              34.615126683462194
            ],
            [
              71.08154296875,
              34.615126683462194
            ],
            [
              71.08154296875,
              34.125447565116126
            ]
          ]
        ]
      }
,
  "outputType": "geojson",
  "columns": {},
  "osmTags": {},
  "osmElements": [],
  "geometryType": []
}

Acceptance Criteria:

  1. Geometry
  1. Geometry Type
  1. OSM Elements
  1. Columns
  1. OSM Tags
  1. Output Type: GeoJSON - Compressed format: zip
kshitijrajsharma commented 2 years ago

After research I found out Hot export binds features based on the geometry also while looking at the common query from operpass turbo they need osm element type sometimes as well i.e. nodes,ways and relations Hence I have decided to support both of the case scenario To support Geometry Type, I have added following geometry type for now :

    POINT="POINT"
    LINESTRING = "LINESTRING"
    POLYGON = "POLYGON"
    MULTILINESTRING = "MULTILINESTRING"
    MULTIPOLYGON = "MULTIPOLYGON" 

User can request what type of geometry feature they want in return and we will be searching for those feature in all the relavant osm elements (nodes , ways , relation ) end user will not know about all those process what he / she will be getting is the features with those geometry . Let's say I have made request I want building polygons then I will be searching all the features with polygon geometry in relation , nodes , ways (wherever possible ) and deliver result back to them just like how hot export works right now Now for the second case scenario that user may want to get features based on the osm element types , I have added them as well as optional

    NODES = "nodes"
    WAYS_LINE = "ways_line"
    WAYS_POLY = "ways_poly"
    RELATIONS = "relations" 

Like this they can specify osm element type they want and we will be delivering based on their input all the geometries available Acceptance Criteria : Now we have two input fields i.e. osm_elements(nodes,ways_line,ways_poly,relations) , geometry_type(POINT,POLYGON,MULTIPOLYGON,MULTILINESTRING,LINESTRING)

ramyaragupathy commented 2 years ago

Original description updated to capture other fields included in this endpoint.

cc @itskshitiz321