Package: arlulaapi
Arlula API Python PackageAboutThe Arlula API allows users to query databases of satellite imagery from vendors around the world. This powerful tool allows users to search and compare the quality of global image datasets and order them at scale. The Arlula API is a new way in which people from around the world can access timely satellite imagery and create their own data streams from space!The Arlula Python package makes it easy to access all of the API functionality without having to do any of the hard work.A more verbose tutorial can be found athttps://arlula.com/using-your-arlula-api-key-python/.PrerequisitesThis package requires an active Arlula account and access to the API credentials. If you don't have an account, you can create one atapi.arlula.com/signup.InstallationpipinstallarlulaapiInitiationInstantiate an ArlulaSession object using your API credentials as below. This will validate your credentials and store them for the remainder of the session.importarlulaapi"""opening a session"""arlula_session=arlulaapi.ArlulaSession(key,secret)# Call required methods"""using a context manager"""witharlulaapi.ArlulaSession(key,secret)asarlula_session:# Call required methodsUtilitiesA maximum cloud filter can be set on search results. If unset, it defaults to 100%.# Only return images with <40% cloudarlula_session.set_max_cloud(40)API EndpointsThis package contains methods for each of the supported API endpoints. Each method returns an object as prescribed in the Arlula API documentation. The available parameters and an example of each method is below:Search# Available parameters:search_result=arlula_session.search(start="string",end="string"res="string",lat=float,long=float,north=float,south=float,east=float,west=float)search_result=arlula_session.search(start="2014-01-01",res="vlow",lat=40.84,long=60.15)Orderorder=arlula_session.order(id=orderId,eula="",seats=1,webhooks=[...],emails=[...])Get resource## Downloads the resource to the specified filepath# Optional suppress parameter controls console outputarlula_session.get_resource(id=resourceId,filepath="downloads/thumbnail.jpg",# optionalsuppress="false")Get order(s)order=arlula_session.get_order(id="orderId")orders=arlula_session.list_orders()Other methods(experimental)As well as supporting all of the Arlula API endpoints, this package provides other mechanisms of utilising the API.Group searchThe ArlulaSessiongsearchmethod allows you to perform multiple searches at once, and have the results collated into a large search result object. To use the group search method, pass a list ofGroupSearchobjects, as below. The parameters for each search must pass the same requirements as thesearchmethod.group_search=[{"start":"2014-01-01","res":"vlow","lat":40.84,"long":60.15},{"start":"2014-01-01","end":"2014-02-01","res":"vlow","lat":30,"long":30},{"start":"2015-01-03","end":"2015-03-03","res":"vlow","south":-29.5,"north":30.5,"east":30.5,"west":-29.5}]search_result=arlula_session.gsearch(group_search)# A list of search result objectsOrder downloadThe Arlula API also provides the option to download an entire order's resources into a specified folder, as below. You may also pass an optionalsuppressparameter to remove all console output.arlula_session.get_order_resources(id=orderId,folder="downloads/ordersample",suppress=True)Search by postcodeThe ArlulaSessionsearch_postcodemethod utilises thepgeocodeAPI to search by postcode. The method requires a country'stwo-letter ISO code, and can take either a single postcode or a list of postcodes. The returned object will contain alocationobject, withpostcode,lat,longandname, and adataobject, which contains either the search result or the gsearch result (depending on if more than 1 postcode is passed into the function).
An optionalboxsizeparameter may be passed in to create a bounding box around each location - this box is a square, with each edgeboxsizekms from the postcode's centroid.# Searches a 10x10km square centred on Parisres=arlula_session.search_postcode(start="2019-01-01",res="vlow",country="fr",postcode="75013",boxsize=5)print(res.location.name)# prints "Paris"search_result=res.data# Searches each of Australia's capital citiesres=arlula_session.search_postcode(start="2019-01-01",end="2019-03-01",res="med",country="au",postcode=["2000","2600","3000","4000","5000","6000","7000","0800"],)print(res[2].location.name)# prints "Melbourne"search_result=res[2].data# Melbourne search resultAdvancedAllow async featuresAsync features can be turned on at instantiation for better performance in gsearch.arlula_session=arlulaapi.ArlulaSession(key,secret,allow_async=True)Note that it is up to the user to monkey-patch with the gevent package, i.e. including the following code at the very top of their python file:fromgeventimportmonkeyascurious_georgecurious_george.patch_all(thread=False,select=False)