LF View API Python Client Library

https://img.shields.io/pypi/v/lfview-api-client.svg https://readthedocs.org/projects/lfview/badge/ https://travis-ci.com/seequent/lfview-api-client.svg?branch=master https://codecov.io/gh/seequent/lfview-api-client/branch/master/graph/badge.svg https://img.shields.io/badge/license-MIT-blue.svg

Warning

The LF View API and all associated Python client libraries are in pre-release. They are subject to change at any time, and backwards compatibility is not guaranteed.

What is lfview-api-client?

This library is used to login to and interact with the LF View API in a Python environment. It simplifies uploading and downloading API resource types, including

Installation

You may install this library using pip with

pip install lfview-api-client

or from Github

git clone https://github.com/seequent/lfview-api-client.git
cd lfview-api-client
pip install -e .

Quickstart

After installing, you may build LF View spatial resources in Python

from lfview.resources import files, spatial

point_set = spatial.ElementPointSet(
    name='Example PointSet Element',
    vertices=files.Array([
        [0., 0, 0],
        [1, 1, 1],
        [2, 2, 2],
    ]),
    data=[
        spatial.DataBasic(
            name='Example PointSet Attribute',
            array=files.Array([-10., 0, 10]),
            location='nodes',
        ),
    ]
)

Then, with your resources, create a View

from lfview.resources import manifests

view = manifests.View(
    name='Example View',
    elements=[
        point_set,
    ],
)

Next, sign up on LF View if you do not yet have an account. Once you have signed up, generate an API key. With your API key, login and upload your View.

from lfview.client import Session

session = Session('your-api-key')
session.upload(view)