
Security News
minimatch Patches 3 High-Severity ReDoS Vulnerabilities
minimatch patched three high-severity ReDoS vulnerabilities that can stall the Node.js event loop, and Socket has released free certified patches.
adamapi
Advanced tools
sudo apt-get install python3-venv python3-gdal gdal-bin
VENVNAME="adamapi"
python3 -m venv "${VENVNAME}"
source "${VENVNAME}/bin/activate";
python3 -m pip install --upgrade pip;
pip install adamapi
ln -s "/usr/lib/python3/dist-packages/osgeo" "${VENVNAME}/lib/python3.10/site-packages/osgeo"
This document briefly describes the ADMAPI functionalities.
The ADAMAPI library is divided in 4 modules:
This module takes care of user authentication and authorization.
Without instancing an object of this module other components don't work.
Auth module is based on the ADAMAPI_KEY, a key that uniquelly identifies the user.
Class contructor and parameters
from adamapi import Auth
a = Auth()
Parameters:
| position/keyword | mandatory | type | default | description |
|---|---|---|---|---|
Public methods and parameters
| position/keyword | mandatory | type | default | description |
|---|---|---|---|---|
| 0 | True | str | The ADAMAPI_KEY |
| position/keyword | mandatory | type | default | description |
|---|---|---|---|---|
| 0 | True | str | The url like https://test.adamplatform.eu |
| position/keyword | mandatory | type | default | description |
|---|---|---|---|---|
| position/keyword | mandatory | type | default | description |
|---|---|---|---|---|
To get the ADAMAPI_KEY, you need to access your ADAM portal and:
Command-line ADAMAPI_KEY retrieval TBP
There are three methods to setup the ADAMAPI_KEY and the ADAM-CORE instance:
from adamapi import Auth
a = Auth()
a.setKey('<ADAMAPI_KEY>')
a.setAdamCore('https://test.adamplatform.eu')
#open a Terminal and type:
export ADAMAPI_KEY='<ADAMAPI_KEY>'
export ADAMAPI_URL='https://test.adamplatform.eu'
key=<ADAMAPI_KEY>
url=https://test.adamplatform.eu
After ADAMAPI_KEY has been set up, an auth instance can be created with:
from adamapi import Auth
a = Auth()
a.authorize()
After authorize method you can retrive your autho token:
from adamapi import Auth
a = Auth()
a.authorize()
a.getAuthToken()
This module provides datasets discovery functionality.
Class contructor and parameters
from adamapi import Datasets
datasets = Datasets( a )
Parameters:
| position/keyword | mandatory | type | default | description |
|---|---|---|---|---|
| 0 | True | Auth instance | The ADAMAPI authorized instance obtained in the previous section |
Public methods and parameters
| position/keyword | mandatory | type | default | description |
|---|---|---|---|---|
| 0 | False | str | The datasetId. | |
| page | False | numeric | 0 | Indicats a specific page |
| maxRecords | False | numeric | 10 | Max number of results in output. |
This .getDatasets() function can be used to retrive additional filters which are described in the key filtersEnabled (if exists).
This module can be used in 2 different ways.
datasets = Datasets(a)
print(datasets.getDatasets())
datasets = Datasets(a)
print( datasets.getDatasets( '{{ID:DATASET}}' , page=0 , maxRecords=10 ) )
datasets = Datasets(a)
out=datasets.getDatasets("{{ID:DATASET}}")
print(out["filtersEnabled"])
This module provides discovery functionality through the products available on the ADAM instance.
Class contructor and parameters
from adamapi import Search
search = Search( a )
Parameters:
| position/keyword | mandatory | type | default | description |
|---|---|---|---|---|
| 0 | True | Auth instance | The ADAMAPI authorized instance obtained in section 1-Auth |
Public methods and parameters
Parameters:
| position/keyword | mandatory | type | default | description |
|---|---|---|---|---|
| 0 | True | str | The datasetId. | |
| maxRecords | False | int | 10 | number of records |
| startIndex | False | int | 0 | starting record index |
| startDate | False | str or datetime | the start date | |
| endDate | False | str or datetime | the end date | |
| geometry | False | str or geojson | GeoJson geometry,geojson format appendix |
search=Search(a)
mongo_search=search.getProducts('{{ID:DATASET}}',maxRecords=1,startIndex=0,platform="{{VALUE}}")
search=Search(a)
mongo_search=search.getProducts('{{ID:DATASET}}',maxRecords=1,startIndex=0)
This module provides data access of raster, spatial subset, timeseries in the native data granularity and reduced processing capacity.
Class contructor and parameters
from adamapi import GetData
data=GetData(a)
Parameters:
| position/keyword | mandatory | type | default | description |
|---|---|---|---|---|
| 0 | True | Auth Instance | The ADAMAPI authorized instance obtained in the section 1-Auth |
Public methods and parameters
| position/keyword | mandatory | type | default | description |
|---|---|---|---|---|
| 0 | True | str | The datasetId | |
| 1 | True | str | GetFile | request type. available values: GetFile,GetSubset, GetTimeseries and GetProcessing |
| asynchronous | False | boolean | False | rappesents how the request will be performed |
| compress | False | boolean | False | return a zip file |
| rest | False | boolean | True | perform RESTful order ignoring explorer state on the server and equalization configured using the explorer gui |
| filters | True | json | {} | json object with filters parameter. startDate and endDate are required inside it. Geometry is not required for GetFile operation, it is otherwise |
| options | False | json | {} | request option |
| outputDir | False | str | adamapiresults/ | set a different download directory inside adamapiresult/ main directory |
data=GetData(a)
#to retrive a specific product
image = data.getData('{{ID:DATASET}}',"GetFile",asynchronous=False,compress=False,rest=False,filters={"startDate":'{{STARTDATE}}',"endDate":'{{ENDDATE}}',"productId":'{{PRODUCTID}}'},outputDir='{{OUTPUT_DIR}}')
#to retrieve a dataset in its native granularity
data=GetData(self.a)
image = data.getData('{{ID:DATASET}}',"GetFile",asynchronous=False,compress=False,rest=False,filters={"startDate":'{{STARTDATE}}',"endDate":'{{ENDDATE}}',"geometry":'{{GEOMETRY}}'},outputDir='{{OUTPUT_DIR}}')
For the GetSubset,GetTimeseries and GetProcessing requests you need to add the options parameter with these constraints : output formats and functions(only for processing request)
#subset example
image = data.getData('{{ID:DATASET}}',"GetSubset",asynchronous=False,compress=False,rest=False,filters={"startDate":'{{STARTDATE}}',"endDate":'{{ENDDATE}}',"geometry":'{{GEOMETRY}}'},options={"format":'{{FORMATS}}'},outputDir='{{OUTPUT_DIR}}')
#timeseries example
image = data.getData('{{ID:DATASET}}',"GetTimeseries",asynchronous=False,compress=False,rest=False,filters={"startDate":'{{STARTDATE}}',"endDate":'{{ENDDATE}}',"geometry":'{{GEOMETRY}}'},options={"format":'{{FORMATS}}'},outputDir='{{OUTPUT_DIR}}')
#processing example
image = data.getData('{{ID:DATASET}}',"GetProcessing",asynchronous=False,compress=False,rest=False,filters={"startDate":'{{STARTDATE}}',"endDate":'{{ENDDATE}}',"geometry":'{{GEOMETRY}}'},options={"format":'{{FORMAT}}',"function":'{{FUNCTION}}'},outputDir='{{OUTPUT_DIR}}')
#1. execute the request
image = data.getData('{{ID:DATASET}}',"GetSubset",asynchronous=False,compress=False,rest=False,filters={"startDate":'{{STARTDATE}}',"endDate":'{{ENDDATE}}',"geometry":'{{GEOMETRY}}'},options={"format":'{{FORMATS}}'},outputDir='{{OUTPUT_DIR}}')
#2. check the status
stat=data.getData(datasetId,"GetSubset",asynchronous=True,id=str(image.pk))
while stat.status != "completed":
time.sleep(1)
stat=data.getData(datasetId,"GetSubset",asynchronous=True,id=str(image.pk))
#3. download the zip,unzip it and remove the zip (optional)
for res in stat.list:
if res["status"] == "failed":
print(res["exit_code"])
else:
r=self.a.client(res["download"]["url"],{},"GET")
with open(str(res["download"]["url"].split("/")[4])+"_"+str(res["download"]["url"].split("/")[5]), 'wb' ) as f:
f.write( r.content )
Supported string date/date+time format are:
Geometry have to follow the latest geojson standard rfc7946
In particular Polygons and MultiPolygons should follow the right-hand rule
#This geometry will return all the results it has intersected within it
geometry = { "type": "Polygon", "coordinates": [ [ [ 43.916666667, 15.716666667 ], [ 43.916666667, 15.416666667 ] , [ 44.216666667, 15.416666667 ], [ 44.216666667, 15.716666667 ], [ 43.916666667, 15.716666667 ] ] ] }
#This geometry will return all the results it has intersected on its outside
geometry = { "type": "Polygon", "coordinates": [ [ [ 43.84986877441406,15.925676536359038 ], [ 44.6539306640625,15.950766025306109 ],[ 44.681396484375,15.194084972583916 ], [ 43.8189697265625,15.20998780073036 ], [ 43.84986877441406,15.925676536359038 ] ] ] }
| request | output format |
|---|---|
| GetFile | - |
| GetSubset | tiff,png |
| GetTimeseries | json,csv |
| GetProcessing experimental | tiff,png |
| type | description |
|---|---|
| average | When the GetProcessing retrieves a multi-band product or a set of products it executes the average of their values |
| overlap | When the GetProcessing retrieves a set of products, it executes their overlap without any specific strategy |
| mosterecent | When the GetProcessing retrieves a set of products, it puts on the top the most recent one |
| leastrecent | When the GetProcessing retrieves a set of products, it puts on top the least recent one |
| minvalue | When the GetProcessing retrieves a multi-band product or a set of products for each pixel it puts on top the minimum value of the pixel |
| maxvalue | When the GetProcessing retrieves a multi-band product or a set of products for each pixel it for each pixel, puts on top the maximum value of the pixel |
FAQs
Python Adam API
We found that adamapi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
minimatch patched three high-severity ReDoS vulnerabilities that can stall the Node.js event loop, and Socket has released free certified patches.

Research
/Security News
Socket uncovered 26 malicious npm packages tied to North Korea's Contagious Interview campaign, retrieving a live 9-module infostealer and RAT from the adversary's C2.

Research
An impersonated golang.org/x/crypto clone exfiltrates passwords, executes a remote shell stager, and delivers a Rekoobe backdoor on Linux.