earthdaily / qgis-plugin

🗺️ To be able to discover, request and use aggregate imagery products based on landsat-8/9, Sentinel 2 and other sensors from within QGIS, using the <geosys/> API.
GNU General Public License v3.0
15 stars 9 forks source link

RX map creation #252

Open vermeulendivan opened 2 years ago

vermeulendivan commented 2 years ago

The user should be allowed to create Rx maps. Quick summary:

Fetch RX map parameters for user:

New section for RX maps:

Two options on where to choose format:

API workflow:

  1. Creation of the Rx map:
    • Map ID from sample map
    • Number of zones
  2. Save the RX map ID
  3. Save the area size for each zone (client side or server side calc?)
  4. Create the RX map by the user:
    • The user can change the value if they want to - the API response will show the number of updated values (count?)
    • Create the RX map based on the chosen format
vermeulendivan commented 2 years ago

API End points to use:

osundwajeff commented 6 days ago
osundwajeff commented 6 days ago
osundwajeff commented 6 days ago
osundwajeff commented 5 days ago

Hi @mal147 Do you have an example of a payload used for rx-maps?

mal147 commented 3 days ago

Hello @osundwajeff , RxMap_MPv5.postman_collection.json I have created this specific Postman collection to showcase you how to create a Rxmap.

After a selection of a base reference map (NDVI for example) and a number of zones by the user (the map id and the number of zones must be stored to be used on next request).

Create a Rx Map from zoned base reference map: `import requests import json

url = "http://api.geosys-na.net/field-level-maps/v5/maps/rx-map?colorMapId=RX&storeRequest=true&directLinks=true&zoning=true&minZoneSize=0.01"

payload = json.dumps({ "name": "MyRx MPv5", "tags": [ "RX_MAP" ], "sourceMapId": "4FBOtVzFALrcVH2pZXFv6N", "zoneCount": "5" }) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkRDQjZGQ0NEM0MyMjI5QzdFRTk1QTZBOUJDQkRCRTI2RjMwNjg1ODRSUzI1NiIsInR5cCI6IkpXVCIsIng1dCI6IjNMYjh6VHdpS2NmdWxhYXB2TDItSnZNR2hZUSJ9.eyJuYmYiOjE3MzIyMTk5MTcsImV4cCI6MTczMjIyMzUxNywiaXNzIjoiaHR0cHM6Ly9pZGVudGl0eS5nZW9zeXMtbmEuY29tL3YyLjEiLCJhdWQiOiJodHRwczovL2lkZW50aXR5Lmdlb3N5cy1uYS5jb20vdjIuMS9yZXNvdXJjZXMiLCJjbGllbnRfaWQiOiJtYXBwcm9kdWN0X2FwaSIsInN1YiI6IjEwMDExMTIzNSIsImF1dGhfdGltZSI6MTczMjIxOTkxNywiaWRwIjoibG9jYWwiLCJnZW82X3N1YiI6IlFnSTZPcmJSakVzUmZpTlp0VlBwNCIsImlhdCI6MTczMjIxOTkxNywic2NvcGUiOlsib3BlbmlkIiwib2ZmbGluZV9hY2Nlc3MiXSwiYW1yIjpbInBhc3N3b3JkIl19.aaW4Zd2MPFAmwjvA6fGDLcqCl43mGNt5201ttjLxYrykHDJ6ftKXxj9-L0O_knjegayaxQGTubQBFSOjWNaBRvkWKIZJ4BHEY0TtYpVCD-EGGyuasEajMv_7UWgWiv0PY8c9FA1Gv6b15O3V0mRKosDSaUnBCLNqShMYqZpokckNJqDRiXrmHgac4Br0wQ5DUQ6HpxZ1iAjF1UhvTtM2sCGU1VymbV6DSK2QSNNF8b42SeLBeQyNNA54pcRf73gHzIT5EQ_edoot-yXfOCVrTwvnleicW9KPYjSmZC2h-ixJ4NAQXIgaOsc93sBvOOQXxKyPgsAhHkqzGfNVR0kWGw' }

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text) `

Attribute values to the Rx Map using the value defined by the user on the new window (2nd screenshot at the top of the ticket)

`import requests import json

url = "http://api.geosys-na.net/field-level-maps/v5/maps/CXPvlY6KMuDNUhXe2lYYT/rx-map"

payload = json.dumps([ { "op": "add", "path": "/parameters/zones/0/attributes/value", "value": "50" }, { "op": "add", "path": "/parameters/zones/1/attributes/value", "value": "60" }, { "op": "add", "path": "/parameters/zones/2/attributes/value", "value": "70" }, { "op": "add", "path": "/parameters/zones/3/attributes/value", "value": "80" }, { "op": "add", "path": "/parameters/zones/4/attributes/value", "value": "100" } ]) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkRDQjZGQ0NEM0MyMjI5QzdFRTk1QTZBOUJDQkRCRTI2RjMwNjg1ODRSUzI1NiIsInR5cCI6IkpXVCIsIng1dCI6IjNMYjh6VHdpS2NmdWxhYXB2TDItSnZNR2hZUSJ9.eyJuYmYiOjE3MzIyMTk5MTcsImV4cCI6MTczMjIyMzUxNywiaXNzIjoiaHR0cHM6Ly9pZGVudGl0eS5nZW9zeXMtbmEuY29tL3YyLjEiLCJhdWQiOiJodHRwczovL2lkZW50aXR5Lmdlb3N5cy1uYS5jb20vdjIuMS9yZXNvdXJjZXMiLCJjbGllbnRfaWQiOiJtYXBwcm9kdWN0X2FwaSIsInN1YiI6IjEwMDExMTIzNSIsImF1dGhfdGltZSI6MTczMjIxOTkxNywiaWRwIjoibG9jYWwiLCJnZW82X3N1YiI6IlFnSTZPcmJSakVzUmZpTlp0VlBwNCIsImlhdCI6MTczMjIxOTkxNywic2NvcGUiOlsib3BlbmlkIiwib2ZmbGluZV9hY2Nlc3MiXSwiYW1yIjpbInBhc3N3b3JkIl19.aaW4Zd2MPFAmwjvA6fGDLcqCl43mGNt5201ttjLxYrykHDJ6ftKXxj9-L0O_knjegayaxQGTubQBFSOjWNaBRvkWKIZJ4BHEY0TtYpVCD-EGGyuasEajMv_7UWgWiv0PY8c9FA1Gv6b15O3V0mRKosDSaUnBCLNqShMYqZpokckNJqDRiXrmHgac4Br0wQ5DUQ6HpxZ1iAjF1UhvTtM2sCGU1VymbV6DSK2QSNNF8b42SeLBeQyNNA54pcRf73gHzIT5EQ_edoot-yXfOCVrTwvnleicW9KPYjSmZC2h-ixJ4NAQXIgaOsc93sBvOOQXxKyPgsAhHkqzGfNVR0kWGw' }

response = requests.request("PATCH", url, headers=headers, data=payload)

print(response.text) `

Then, deliver the RX map to the user

`import requests

url = "http://api.geosys-na.net/field-level-maps/v5/maps/CXPvlY6KMuDNUhXe2lYYT?directlinks=true"

payload = {} headers = { 'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkRDQjZGQ0NEM0MyMjI5QzdFRTk1QTZBOUJDQkRCRTI2RjMwNjg1ODRSUzI1NiIsInR5cCI6IkpXVCIsIng1dCI6IjNMYjh6VHdpS2NmdWxhYXB2TDItSnZNR2hZUSJ9.eyJuYmYiOjE3MzIyMTk5MTcsImV4cCI6MTczMjIyMzUxNywiaXNzIjoiaHR0cHM6Ly9pZGVudGl0eS5nZW9zeXMtbmEuY29tL3YyLjEiLCJhdWQiOiJodHRwczovL2lkZW50aXR5Lmdlb3N5cy1uYS5jb20vdjIuMS9yZXNvdXJjZXMiLCJjbGllbnRfaWQiOiJtYXBwcm9kdWN0X2FwaSIsInN1YiI6IjEwMDExMTIzNSIsImF1dGhfdGltZSI6MTczMjIxOTkxNywiaWRwIjoibG9jYWwiLCJnZW82X3N1YiI6IlFnSTZPcmJSakVzUmZpTlp0VlBwNCIsImlhdCI6MTczMjIxOTkxNywic2NvcGUiOlsib3BlbmlkIiwib2ZmbGluZV9hY2Nlc3MiXSwiYW1yIjpbInBhc3N3b3JkIl19.aaW4Zd2MPFAmwjvA6fGDLcqCl43mGNt5201ttjLxYrykHDJ6ftKXxj9-L0O_knjegayaxQGTubQBFSOjWNaBRvkWKIZJ4BHEY0TtYpVCD-EGGyuasEajMv_7UWgWiv0PY8c9FA1Gv6b15O3V0mRKosDSaUnBCLNqShMYqZpokckNJqDRiXrmHgac4Br0wQ5DUQ6HpxZ1iAjF1UhvTtM2sCGU1VymbV6DSK2QSNNF8b42SeLBeQyNNA54pcRf73gHzIT5EQ_edoot-yXfOCVrTwvnleicW9KPYjSmZC2h-ixJ4NAQXIgaOsc93sBvOOQXxKyPgsAhHkqzGfNVR0kWGw' }

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text) `

Please don't hesitate for any questions you have!

cc @mvmaltitz

osundwajeff commented 3 days ago

Thanks @mal147, I'll go through it