1 of 11

Drawings

API definition

2 of 11

Goal: store, retrieve & list drawings

End result drawing tool:

(All these fields should eventually be stored in the DB)

https://gitlab.com/opengeoweb/geoweb-assets/-/issues/2675

End result area manager (list of drawings):

https://gitlab.com/opengeoweb/geoweb-assets/-/issues/2676

3 of 11

MVP drawing

Store:

  • GeoJSON
  • Opacity (part of the GeoJSON)
  • Name
  • lastUpdatedTime
  • unique id
  • scope (system, user)
  • username

From User Story:

As a user I want to save my drawn polygon, so I can re-use it.

Save polygon

  • name and timestamp of saving the object will be stored
  • default name for saving is shown in toolbox
  • default name is current timestamp
  • user can edit default name (if user changes name later, the associated timestamp will be updated)
  • user select save in toolbox
  • the result of the save action will be shown to the user (snackbar)
  • saved drawing objects are personal
  • saved objects are listed (initially as a list, later in the object manager)

Additional comments New BE for storing objects? Probably.

MVP design: https://app.zeplin.io/project/5ecf84a3c6ae1047a368f393/screen/64956cfe39ec23476bc3b1c8

4 of 11

MVP list

From User Story:

As a user, I would like to have acces to my saved polygons for further use.

Drawing object manager

  • can be opened from map view
  • lists all saved polygons
  • shows names of polygons
  • order by timestamp saved
  • breaks by day are not to be implemented in MVP
  • map is a list of saved objects without option for user to use options (like editing), nor interaction between objects on map and objects in objectmanager

Test criteria

  • open objectmanager
  • a list of saved objects are shown, sorted by timestamp

Link to design

  • in epic description

Suggestion to also be able to open the drawing from the list on the map and in toolbox, otherwise very difficult to test our work

5 of 11

Endpoints needed

  • Retrieve list of drawings: GET /drawings
  • Retrieve one drawing: GET /drawings/{drawing_id}
  • Save a drawing: POST /drawings
  • Update a drawing: POST /drawings/{drawing_id}
  • Delete a drawing: POST /drawings/{drawing_id}?delete=true

6 of 11

JSON: drawing LIST (GET /drawings/ summary of full drawing?)

[

{

"id": "923723984872338768743",

"name": "Drawing area 101",

"lastUpdatedTime": "2022-06-01T12:34:27Z",

"scope": "user",

"area": {...} << NB: Should we include the area here? Better use GET for a single area.

},

{...}

]

with a 200 status

7 of 11

JSON: GET drawing (GET /drawings/{id})

Returns:

{

"id": "923723984872338768743",

"lastUpdatedTime": "2022-06-01T12:34:27Z",

"name": "Drawing area 101",

"scope": "user",

"area"{...<area>...}

}

with a 200 status

8 of 11

JSON: POST drawing (POST /drawings)

POST with content type 'Content-Type: application/json'

{

"name": "Drawing area 101", # has to be unique in the backend for this user.

"scope": "user",

"area": {...<area>...}

}

Returns status 200 with a location header, advertising the new drawing id in the URL:

  • HTTP/1.1 200 OK
  • location: http://0.0.0.0:8080/drawings/791f8556-4e25-11ee-a216-9f1a45bee421/

9 of 11

JSON: UPDATE drawing (POST /drawings/{id})

POST with content type 'Content-Type: application/json' with the drawing id

�{

"name": "New name for drawing area 101",

"scope": "user",

"area": {...<area>...}

}

This API needs to check the credentials, whether it is the same user. (check the Geoweb-UserName against the internal drawing username)

Returns 201 with a location header, advertising the same drawing ID as posted

  • HTTP/1.1 201 OK

10 of 11

JSON: DELETE drawing (POST /drawings/{drawing_id}?delete=true)

�This API needs to check the credentials, whether it is the same user. (check the Geoweb-UserName against the internal drawing username)

Returns status 200 upon successful deletion.

11 of 11

Create tickets

  • Implementation of database
  • Implementation endpoints BE
  • Implementation fake api FE
  • Implementation store for warnings/drawings FE
  • Implementation drawing list (area manager) in FE
  • Implementation functionality drawing toolbox