Skip to content

Commit

Permalink
Add features collections api (#55)
Browse files Browse the repository at this point in the history
* feat: multi resolution api

* feat: draft version of new ROI exporting API - No tests!

* chore: pr notes + finalizing implementation

* fix: lint fix

* fix: log level for polling

* fix: first pr note about files name

* fix: pr round 2 notes

* fix: lint fix

* fix: logging for pr notes

* fix: log for callback

* fix: logs

* fix: improve logs for pr request

* fix: log notes for existing job

* fix: linter

* fix: pr notes + refactoring

* fix: logs on getmap api

* test: integration + unit for ROI API

* fix: prettier

* fix: pr notes for testing

* fix: pr notes for tests #2

* fix: pr notes #3

* fix: prittier
  • Loading branch information
ronenkapelian authored Mar 8, 2023
1 parent 03f16b4 commit 490341b
Show file tree
Hide file tree
Showing 26 changed files with 3,996 additions and 715 deletions.
241 changes: 231 additions & 10 deletions openapi3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ paths:
- createGpkg
summary: Trigger export geopackage process
operationId: exportTilesToGpkg
deprecated: true
requestBody:
$ref: '#/components/requestBodies/ExportGetmapBody'
responses:
Expand Down Expand Up @@ -50,6 +51,50 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/error'
/create/roi:
post:
tags:
- createGpkg
summary: Trigger export geopackages based on providing Regions of interest (multi-resolution)
operationId: byRoi
requestBody:
$ref: '#/components/requestBodies/ExportByRoiBody'
responses:
'200':
description: OK
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/createGpkgJobResponse'
- $ref: '#/components/schemas/exportNaiveCacheJobResponse'
discriminator:
propertyName: response
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'404':
description: Could not find layer with matched dbId
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/internalError'
'507':
description: Insufficient Storage on disk for exporting
content:
application/json:
schema:
$ref: '#/components/schemas/error'

/taskStatus/{jobId}:
get:
tags:
Expand Down Expand Up @@ -97,6 +142,13 @@ components:
application/json:
schema:
$ref: '#/components/schemas/exportGetMap'
ExportByRoiBody:
description: Export to gpkg via FeatureCollection
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/exportFromFeatures'
schemas:
CommonResponse:
type: object
Expand All @@ -119,7 +171,7 @@ components:
description: ID as the primary key from the Raster Catalog
bbox:
oneOf:
- $ref: '#/components/schemas/BBOX'
- $ref: '#/components/schemas/BBox'
- $ref: '#/components/schemas/Geometry'
targetResolution:
type: number
Expand Down Expand Up @@ -149,6 +201,57 @@ components:
- 34.82237261707599
- 31.96426962177354
targetResolution: 0.0000429153442382812
callbackURLs:
- http://example.getmap.com/callback
- http://example.getmap.com/callback2
crs: EPSG:4326
priority: 0
exportFromFeatures:
type: object
properties:
dbId:
type: string
format: uuid
description: ID as the primary key from the Raster Catalog
roi:
$ref: '#/components/schemas/FeatureCollection'
callbackURLs:
type: array
items:
type: string
description: The callback URL to notify the process if finished
crs:
$ref: '#/components/schemas/CRS'
priority:
type: number
description: The priority of the record. Maximum priority = most urgent.
minimum: 0
maximum: 999999999
required:
- dbId
- callbackURLs
example:
dbId: ef03ca54-c68e-4ca8-8432-50ae5ad7a7f8
roi:
type: FeatureCollection
features:
- type: Feature
properties:
maxResolutionDeg: 0.072
geometry:
type: Polygon
coordinates:
- - - 34.82836896556114
- 32.03918441418732
- - 34.81210152170695
- 32.03918441418732
- - 34.81210152170695
- 32.02539369969462
- - 34.82836896556114
- 32.02539369969462
- - 34.82836896556114
- 32.03918441418732

callbackURLs:
- http://example.getmap.com/callback
- http://example.getmap.com/callback2
Expand All @@ -159,10 +262,6 @@ components:
- $ref: '#/components/schemas/CommonResponse'
type: object
properties:
status:
type: string
enum:
- In-Progress
id:
type: string
format: uuid
Expand Down Expand Up @@ -197,7 +296,7 @@ components:
type: string
bbox:
oneOf:
- $ref: '#/components/schemas/BBOX'
- $ref: '#/components/schemas/BBox'
- $ref: '#/components/schemas/Geometry'
targetResolution:
type: number
Expand All @@ -217,6 +316,34 @@ components:
- targetResolution
- requestId
- success
exportNaiveCacheJobResponse:
allOf:
- $ref: '#/components/schemas/CommonResponse'
type: object
properties:
links:
$ref: '#/components/schemas/callbackLinks'
expirationTime:
type: string
format: date
fileSize:
type: number
recordCatalogId:
type: string
format: uuid
roi:
$ref: '#/components/schemas/FeatureCollection'
requestJobId:
type: string
format: uuid
required:
- links
- expirationTime
- fileSize
- recordCatalogId
- roi
- requestJobId
- status
error:
type: object
required:
Expand All @@ -239,7 +366,54 @@ components:
description: List of supported
enum:
- EPSG:4326
BBOX:
Feature:
required:
- type
- properties
- geometry
properties:
type:
type: string
enum:
- Feature
properties:
type: object
required:
- maxResolutionDeg
properties:
maxResolutionDeg:
type: number
minimum: 0.00000009
maximum: 0.072
format: double
description: max resolution of layer in degrees/pixel
# nullable: true
geometry:
type: object
nullable: true
oneOf:
- $ref: '#/components/schemas/GeometryCollection'
- $ref: '#/components/schemas/Geometry'
bbox:
$ref: '#/components/schemas/BBox'
FeatureCollection:
type: object
description: GeoJson Feature collection
required:
- type
- features
properties:
type:
type: string
enum:
- FeatureCollection
features:
type: array
items:
$ref: '#/components/schemas/Feature'
bbox:
$ref: '#/components/schemas/BBox'
BBox:
type: array
items:
type: number
Expand All @@ -265,13 +439,30 @@ components:
- Failed
- Expired
- Aborted
GeometryCollection:
type: object
description: GeoJSon geometry collection
required:
- type
- geometries
externalDocs:
url: http://geojson.org/geojson-spec.html#geometrycollection
properties:
type:
type: string
enum:
- GeometryCollection
description: custom properties
geometries:
type: array
items:
$ref: '#/components/schemas/GeometryBase'
Geometry:
description: GeoJSon geometry
discriminator:
propertyName: type
type: object
allOf:
oneOf:
- $ref: '#/components/schemas/Polygon'
- $ref: '#/components/schemas/MultiPolygon'
Polygon:
type: object
description: GeoJSon geometry
Expand All @@ -286,6 +477,22 @@ components:
type: array
items:
$ref: '#/components/schemas/Point2D'
MultiPolygon:
type: object
description: GeoJSon geometry
externalDocs:
url: http://geojson.org/geojson-spec.html#id6
allOf:
- $ref: '#/components/schemas/GeometryBase'
- properties:
coordinates:
type: array
items:
type: array
items:
type: array
items:
$ref: '#/components/schemas/Point2D'
GeometryBase:
type: object
description: GeoJSon geometry
Expand All @@ -298,7 +505,21 @@ components:
type: string
enum:
- Polygon
- MultiPolygon
description: the geometry type
callbackLinks:
type: object
description: gpkg links - the geoPackage + metadata.json
required:
- dataURI
- metadataURI
properties:
dataURI:
type: string
description: Url to download the gpkg
metadataURI:
type: string
description: Url to download the gpkg's metadata.json
Point2D:
type: array
maxItems: 2
Expand Down
Loading

0 comments on commit 490341b

Please sign in to comment.