Skip to main content

fio_planet: Fiona CLI plugins from Planet Labs.

Project description

fio-planet

A package of Fiona CLI plugins from Planet Labs.

Documentation Status

These CLI commands are for creating Unix pipelines which manipulate streams of GeoJSON features. Such pipelines provide a subset of the functionality of more complicated tools such as GeoPandas, PostGIS, or QGIS, and are intended for use with streams of hundreds of features, where the overhead of JSON serialization between pieces of a pipeline is tolerable.

Installation

python -m pip install --user --pre fio-planet

Usage

fio-planet adds filter, map, and reduce commands to Fiona's fio program. These commands afford some of the capabilities of spatial SQL, but act on features of a GeoJSON feature sequence instead of rows of a spatial RDBMS table. fio-filter decimates a seqence of features, fio-map multiplies and transforms features, and fio-reduce turns a sequence of many features into a sequence of exactly one. In combination, many transformations are possible.

Expressions take the form of parenthesized lists which may contain other expressions. The first item in a list is the name of a function or method, or an expression that evaluates to a function. The second item is the function's first argument or the object to which the method is bound. The remaining list items are the positional and keyword arguments for the named function or method. The list of functions and callables available in an expression includes:

  • Python operators such as +, /, and <=
  • Python builtins such as dict, list, and map
  • All public functions from itertools, e.g. islice, and repeat
  • All functions importable from Shapely 2.0, e.g. Point, and unary_union
  • All methods of Shapely geometry classes
  • Functions specific to fio-planet

Here's an expression that evaluates to a Shapely Point instance.

(Point 0 0)

Point is a callable instance constructor and the pair of 0 values are positional arguments. Note that the outermost parentheses of an expression are optional.

Here's an expression that evaluates to a Polygon, using buffer.

buffer (Point 0 0) :distance 1.0

The inner expression (Point 0 0) evaluates to a Shapely Point instance, buffer evaluates to shapely.buffer(), and :distance 1.0 assigns a value of 1.0 to that method's distance keyword argument.

In a fio-planet expression, all coordinates and geometry objects are in the OGC:CRS84 reference system, like GeoJSON. However, function arguments related to length or area, such as buffer's distance argument, are understood to have units of meters.

fio-filter and fio-map evaluate expressions in the context of a GeoJSON feature and its geometry attribute. These are named f and g. For example, here is an expression that tests whether the input feature is within 50 meters of the given point.

<= (distance g (Point -105.0 39.753056)) 50.0

fio-reduce evaluates expressions in the context of the sequence of all input geometries, which is named c. For example, this expression dissolves input geometries using Shapely's unary_union.

unary_union c

Support

Documentation is hosted at Read the Docs: https://fio-planet.readthedocs.io/en/latest/.

For usage help, please use the project discussion forum or email developers@planet.com.

If you think you've found a bug, please use the project issue tracker.

Roadmap

Version 1.0 adds filter, map, and reduce to Fiona's fio CLI.

Note that there are no conditional forms in 1.0's expressions. The project will likely add a cond after 1.0.

Contributing

Before 1.0 the project is looking for feedback on the existing commands more than it is looking for new commands.

The project uses black, flake8, mypy, and tox for static checks and testing.

black src tests && flake8 && mypy && tox

Authors and acknowledgment

Contributors to this project are

License

Apache License, Version 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fio_planet-1.0b1.tar.gz (57.5 kB view details)

Uploaded Source

Built Distribution

fio_planet-1.0b1-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file fio_planet-1.0b1.tar.gz.

File metadata

  • Download URL: fio_planet-1.0b1.tar.gz
  • Upload date:
  • Size: 57.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for fio_planet-1.0b1.tar.gz
Algorithm Hash digest
SHA256 053b5d617f256bd63713281a78b22b18e74e654dccce6ca0dc90622536daeec6
MD5 cc38130ecb13dc9fc87b948be281fab4
BLAKE2b-256 64994f4076d61c5e3a52029f202ded2cf9eeb9720a645a64d09ceb101c3657e3

See more details on using hashes here.

File details

Details for the file fio_planet-1.0b1-py3-none-any.whl.

File metadata

  • Download URL: fio_planet-1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for fio_planet-1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf5bf76a021b911daa6f3b402739ae6b52782683fa92a99574c21a29c1f1bdca
MD5 857f088900caef927467ceb7c125739b
BLAKE2b-256 e11a21d19d4f037f66dfd6c728c4e02addc2efc34b87004e09d404adc78f85ca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page