NAV Navbar
python
  • Quickstart
  • Authentication
  • Account
  • Flight
  • Quickstart

    from aerospatial import Flight
    import os, glob # python modules
    
    # 1 Create flight
    flight = Flight.new('Field Survey 01', {'aircraft': 'drone', 'date':'2018-06-01'})
    
    print('FlightId: ', flight.id) # -> 'FlightId: e462e9dc-326f-4287-bf05-3e2cc1765d63'
    
    # 2 Upload images
    images = glob.glob('*.jpg')
    for image in images:
        flight.upload(image)
    
    # 3 Start build
    flight.build({'orthophoto-resolution': 20.0})
    
    

    Import the Flight class from the Python SDK. AeroSpatial will validate against your credentials in ~/.aerospatial/credentials (see Authentication).

    1. Create a new flight, specifying a name and an optional dictionary of metadata. Each flight is assigned a unique id.

    2. Using the Python glob module, upload all the images in the current directory.

    3. Start a build for the flight, passing an optional dictionary of OpenDroneMap arguments (see Build).

    To access the build products:

    # After build, get links to build products
    from aerospatial import Flight
    flight = Flight.load('e462e9dc-326f-4287-bf05-3e2cc1765d63')
    products = flight.products()
    


    Once the build is complete, use the flight id to access the build products.

    Authentication

    The SDK manages authentication:

    import Account from aerospatial
    
    account = Account()
    account.listFlights() # -> List all your flights
    

    AeroSpatial uses JSON Web Tokens to authenticate access to the API using your username and password credentials. This process is managed by the SDK.

    Create a file in ~/.aerospatial/credentials in this format:

    [default]
    username = 'USERNAME'
    password = 'PASSWORD'

    Account

    List flights

    To list all your flights:

    import Account from aerospatial
    
    # Initialize your account
    my_account = Account()
    
    # Get a list of your flights and their metadata
    my_flights = my_account.listFlights()
    print(my_flights)
    
    

    The account module allows you to query the flights in your AeroSpatial.io account.

    Flight

    Import

    import flight from aerospatial
    import os, glob # required to upload images
    

    Import the Flight class to access flight methods.

    New

    
    flight = Flight.new('Field Survey 01', {'aircraft': 'drone', 'date':'2018-06-01'})
    
    

    The above command returns a Python object structured like this:

    {
      'splurge':1
    }
    

    The new method accepts a flight name and optional metadata dictionary to create a new flight at AeroSpatial.io.

    The resulting flight object has two attriutes, properties and id.

    Upload

    To upload all images in the current directory:

    import os, glob # python modules
    
    images = glob.glob('*.jpg')
    for image in images:
        flight.upload(image)
    

    The upload method accepts a file name of an image file (e.g. image.jpg) and uploads it to AeroSpatial.io, returning the status of the upload request.

    Build

    To start a build

    odm_arguments = {
      'dtm': True,
      'dem-terrain-type': 'FlatForest'
      'orthophoto-resolution': 20.0,
    }
    flight.build(odm_arguments)
    

    The build method accepts a dictionary of OpenDroneMap arguments with the leading dashes removed, and returns the status of the build request.

    Load

    To load an existing flight

    flight = Flight.load('flightId')
    
    

    The load method accepts the flightId from an existing flight and returns a flight object, which includes the products method for accessing build products.

    Products

    To access build products:

    products = flight.products()
    

    The products method provides links to the build products for a flight.