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

Update SAMZ product #273

Open mvmaltitz opened 1 month ago

mvmaltitz commented 1 month ago

Expectations:

  1. As a EarthDaily user I need to select at least one image to get SAMZ product. It will be no more possible to get “Auto” SAMZ without selecting images. Auto SAMZ is no more available.
  2. As a EarthDaily user I would like to be able to have in the DBF file the zone number, the field Area Percent and the productivity and the variability values.

Acceptance criteria:

  1. When the user is exporting a SAMZ product in SHP, 3 informations must be available on the DBF (one per column) : zone number / fieldAreaPercent / productivityIndex / variabilityIndex

API Examples for SAMZ:

curl --location 'http://api-pp.geosys-na.net/field-level-maps/v5/maps/management-zones-map/SAMZ' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjE1NjdGRUYyMUYzRTZCNjJCRDI0MTlGMTQ0MEQ1OUU4QzM1QUIxMzhSUzI1NiIsInR5cCI6IkpXVCIsIng1dCI6IkZXZi04aDgtYTJLOUpCbnhSQTFaNk1OYXNUZyJ9.eyJuYmYiOjE3MjAwOTg4NTQsImV4cCI6MTcyMDEwMjQ1NCwiaXNzIjoiaHR0cHM6Ly9pZGVudGl0eS5wcmVwcm9kLmdlb3N5cy1uYS5jb20vdjIuMSIsImF1ZCI6Imh0dHBzOi8vaWRlbnRpdHkucHJlcHJvZC5nZW9zeXMtbmEuY29tL3YyLjEvcmVzb3VyY2VzIiwiY2xpZW50X2lkIjoibWFwcHJvZHVjdF9hcGkiLCJzdWIiOiIxMDAxMTEyMzUiLCJhdXRoX3RpbWUiOjE3MjAwOTg4NTQsImlkcCI6ImxvY2FsIiwiZ2VvNl9zdWIiOiJRZ0k2T3JiUmpFc1JmaU5adFZQcDQiLCJpYXQiOjE3MjAwOTg4NTQsInNjb3BlIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIl0sImFtciI6WyJwYXNzd29yZCJdfQ.V1FI_UBey2xoYUMi2D7FNw5kMOmVMT5cAHjzOlQy7BOSKxVdqi_S5p3TzDOVRgWK4J9fa1t57zq1q2IXkSk_8Cx5Hl8sCzWK6GlWzpqBFMfHsA-YNLRtCu7_LsSsRrQr852ESD78XJxHP-TQEBKM-F3dfKwXlQfg_MTzFi20gxPN7JH71kksr00xR6UgITKm_m_hIfPQWm83aFeZQkrdPTowAqJfcHbtZH7k2C93K6_pQubCDwcj6XeBnu3rmnUx1w-I-DKFyekHjZHNAXPcSQeCqTxqAUIdEKAVrRgHMhrtJoCHNOii-NdbF-lEAEPTt2MTOzr6S5FGz4pk-Dc1eQ' \ --data '{ "seasonField":
{ "geometry": "POLYGON ((1.167641 43.68935, 1.168499 43.686339, 1.171288 43.686526, 1.170516 43.683888, 1.167555 43.684508, 1.162877 43.681219, 1.160388 43.682491, 1.161547 43.684136, 1.164079 43.685036, 1.163778 43.68606, 1.162963 43.686526, 1.160216 43.685067, 1.159058 43.684322, 1.156182 43.684074, 1.154981 43.684229, 1.152792 43.686526, 1.152534 43.68696, 1.154895 43.688294, 1.156569 43.687053, 1.158714 43.68727, 1.160517 43.688481, 1.163821 43.690094, 1.164808 43.688574, 1.167641 43.68935))" }, "images":[ { "id": "landsat-c2l2-sr|LC09_L2SP_198030_20240616_20240617_02_T1_SR"}, { "id": "landsat-c2l2-sr|LC09_L2SP_199030_20240420_20240424_02_T1_SR"} ], "zoneCount": 5 }'

API Endpoints to use:

Swagger: https://api-pp.geosys-na.net/field-level-maps/v5/swagger Catalog imagery: /field-level-maps/v5/season-fields/catalog-imagery

mvmaltitz commented 4 days ago

@osundwajeff

import requests import json

url = "http://api.geosys-na.net/field-level-maps/v5/maps/management-zones-map/SAMZ/image.png"

payload = json.dumps({ "seasonField": { "geometry": "MultiPolygon (((-99.61829937000000257 47.47947615000000354, -99.61827789999999538 47.47487869999999788, -99.61664710000000866 47.47476267000000405, -99.61587464000000125 47.47438559999999796, -99.61555277000000785 47.47416805000000295, -99.61518806000000836 47.47367488000000435, -99.61493051000000776 47.473544400000

mvmaltitz commented 4 days ago

body import requests import json url = "http://api.geosys-na.net/field-level-maps/v5/maps/management-zones-map/SAMZ/image.png"

payload = json.dumps({ "seasonField": { "geometry": "MultiPolygon (((...))) , "images": [ { "id": "sentinel-2-c1-l2a|S2B_T14TMT_20241021T173917_L2A" }, { "id": "sentinel-2-c1-l2a|S2A_T14TMT_20241016T173645_L2A" } ], "zoneCount": 5 }) headers = { 'Content-Type': 'application/json', 'Authorization': '••••••' } response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

mal147 commented 4 days ago

complete request :)

import requests import json

url = "http://api.geosys-na.net/field-level-maps/v5/maps/management-zones-map/SAMZ/image.png"

payload = json.dumps({ "seasonField": { "geometry": "MultiPolygon (((-99.61829937000000257 47.47947615000000354, -99.61827789999999538 47.47487869999999788, -99.61664710000000866 47.47476267000000405, -99.61587464000000125 47.47438559999999796, -99.61555277000000785 47.47416805000000295, -99.61518806000000836 47.47367488000000435, -99.61493051000000776 47.47354440000000153, -99.61463012000000106 47.47357336000000316, -99.61454433000000108 47.47373293000000416, -99.61428678000000048 47.47360239000000348, -99.61390059000000008 47.47379091999999901, -99.61310665999999969 47.47368939999999782, -99.61241999000000646 47.47335580000000022, -99.61203371000000573 47.47325427999999903, -99.61177625999999918 47.47267415000000312, -99.61173331999999903 47.47252909000000187, -99.61188352000000634 47.47234054999999842, -99.60774218999999619 47.47229700999999835, -99.60774218999999619 47.47953412999999756, -99.61484472000000778 47.4794616400000038, -99.61496105999999884 47.47948277000000417, -99.6152443299999959 47.47946723000000446, -99.6153940000000091 47.479499330000003, -99.61547219000000553 47.47946126000000078, -99.61553132999999605 47.47949350999999751, -99.61561718000000099 47.47950510999999807, -99.61829937000000257 47.47947615000000354)))" }, "images": [ { "id": "sentinel-2-c1-l2a|S2B_T14TMT_20241021T173917_L2A" }, { "id": "sentinel-2-c1-l2a|S2A_T14TMT_20241016T173645_L2A" } ], "zoneCount": 5 }) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkRDQjZGQ0NEM0MyMjI5QzdFRTk1QTZBOUJDQkRCRTI2RjMwNjg1ODRSUzI1NiIsInR5cCI6IkpXVCIsIng1dCI6IjNMYjh6VHdpS2NmdWxhYXB2TDItSnZNR2hZUSJ9.eyJuYmYiOjE3MzE2NjE4NDUsImV4cCI6MTczMTY2NTQ0NSwiaXNzIjoiaHR0cHM6Ly9pZGVudGl0eS5nZW9zeXMtbmEuY29tL3YyLjEiLCJhdWQiOiJodHRwczovL2lkZW50aXR5Lmdlb3N5cy1uYS5jb20vdjIuMS9yZXNvdXJjZXMiLCJjbGllbnRfaWQiOiJrZXlfYWNjb3VudF90ZWFtIiwic3ViIjoiMTAwMTExMjM1IiwiYXV0aF90aW1lIjoxNzMxNjYxODQ1LCJpZHAiOiJsb2NhbCIsImdlbzZfc3ViIjoiUWdJNk9yYlJqRXNSZmlOWnRWUHA0IiwiaWF0IjoxNzMxNjYxODQ1LCJzY29wZSI6WyJvcGVuaWQiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicGFzc3dvcmQiXX0.HeW7Zj4K3okYlGHSOKROjZieNglXS0h7MLgchzKwQ8P2d0y_NcsTEwuUuc7MHpY_CaVstOijPym1necyFwWFa_1H1z3bKUKKbDRCSW9O1Tet1mLjvrxPAW5tZ3aBeg-RjIbo4aozUTy57ZfDg40hVl0taW4BCZC7Z8qmSeGmfA1OZwPQZ72LRn4k20_mHlfyqAiD4P3eD1iFpjFk4fgtKOKylwls9u2emNvEWS-ciurzou4i4ux1u6e6431NQ-RDRN-dFHukk_Mp6ipttSKgC4VgK_1viirk0-qDU5eoqz1pLXM8-r_JV_YBpD2Lm8EmUvXW4m-6u4rLD3NZpyYD6g' }

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

print(response.text)