natcap / urban-online-workflow

This repository hosts the beta implementation of the Urban Online ES Workflow. The project is intended to give urban planners the ability to create and assess scenarios using InVEST Urban models.
1 stars 5 forks source link

Pattern thumbnail endpoint #56

Closed dcdenu4 closed 1 year ago

dcdenu4 commented 1 year ago

This PR finishes the loop with PR #54 by creating server api endpoints to facilitate the creation of pattern thumbnails.

Pattern creation is now a job that is put on the queue for the backend worker to generate a thumbnail. Once the worker completes the task the api endpoint will return the following when requested by the frontend:

[
  {
    "label": "test2",
    "wkt": "POLYGON ((-10968318.16 3429247.98, -10968318.16 3429447.98, -10968518.16 3429447.98, -10968518.16 3429247.98, -10968318.16 3429247.98))",
    "pattern_id": 1,
    "pattern_thumbnail_path": "/opt/appdata/model_outputs/thumbnails/pattern_1_thumbnail.png"
  },
  {
    "label": "test3",
    "wkt": "POLYGON ((-10968318.16 3429247.98, -10968318.16 3429447.98, -10968518.16 3429447.98, -10968518.16 3429247.98, -10968318.16 3429247.98))",
    "pattern_id": 2,
    "pattern_thumbnail_path": "/opt/appdata/model_outputs/thumbnails/pattern_2_thumbnail.png"
  },
]

Fixes #44