Coder Social home page Coder Social logo

fio-buffer's Introduction

fio-buffer

https://travis-ci.org/toblerity/fio-buffer.svg?branch=master https://coveralls.io/repos/toblerity/fio-buffer/badge.svg?branch=master

A Fiona CLI plugin for buffering geometries in parallel. Powered by Shapely.

Usage

Usage: fio buffer [OPTIONS] INFILE OUTFILE

  Geometries can be dilated with a positive distance, eroded with a negative
  distance, and in some cases cleaned or repaired with a distance of 0.

  Examples
  --------

  Default settings - buffer geometries in the input CRS:

      $ fio buffer in.geojson out.geojson --distance 10

  Dynamically buffer geometries by a distance stored in the field
  'magnitude' and write as GeoJSON:

      $ fio buffer \
          in.shp \
          out.geojson \
          --driver GeoJSON \
          --distance magnitude

  Read geometries from one CRS, buffer in another, and then write to a
  third:

      $ fio buffer in.shp out.shp \
          --distance 10 \
          --buf-crs EPSG:3857 \
          --dst-crs EPSG:32618

  Control cap style, mitre limit, segment resolution, and join style:

      $ fio buffer in.geojson out.geojson \
          --distance 0.1 \
          --res 5 \
          --cap-style flat \
          --join-style mitre \
          --mitre-limit 0.1\

Options:
  --version                       Show the version and exit.
  -f, --format, --driver NAME     Output driver name.  Derived from the input
                                  datasource if not given.
  --cap-style [flat|round|square]
                                  Where geometries terminate, use this style.
                                  [default: round]
  --join-style [round|mitre|bevel]
                                  Where geometries touch, use this style.
                                  [default: round]
  --res INTEGER                   Resolution of the buffer around each vertex
                                  of the geometry.  [default: 16]
  --mitre-limit FLOAT             When using a mitre join, limit the maximum
                                  length of the join corner according to this
                                  ratio.  [default: 5.0]
  --distance FLOAT|FIELD          Buffer distance or field containing distance
                                  values.  Units match --buf-crs.  When
                                  buffering with a field, feature's with a
                                  null value are unaltered.  [required]
  --src-crs TEXT                  Specify CRS for input data.  Not needed if
                                  set in input file.
  --buf-crs TEXT                  Perform buffer operations in a different
                                  CRS. [default: --src-crs]
  --dst-crs TEXT                  Reproject geometries to a different CRS
                                  before writing.  Must be combined with
                                  --buf-crs. [default: --src-crs]
  --geom-type GEOMTYPE            Output layer's geometry type.  [default:
                                  MultiPolygon]
  --skip-failures                 Skip geometries that fail somewhere in the
                                  processing pipeline.
  --jobs CORES                    Process geometries in parallel across N
                                  cores.  Feature ID's and order are not
                                  preserved if more that 1 cores are used.
                                  [default: 1]
  --help                          Show this message and exit.

Installing

Via pip:

$ pip install fio-buffer

From source:

$ git clone https://github.com/toblerity/fio-buffer
$ cd fio-buffer
$ python setup.py install

Developing

$ git clone https://github.com/toblerity/fio-buffer
$ cd fio-buffer
$ virtualenv venv
$ source venv/bin/activate
$ pip install -e .[dev]
$ py.test tests --cov fio_buffer --cov-report term-missing

License

See LICENSE.txt.

fio-buffer's People

Contributors

geowurster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fagan2888

fio-buffer's Issues

Release v0.1.1

Waiting on Toblerity/Fiona#213

  • Add a unittest to verify that the command is registering properly with fio
  • Update setup.py to require Fiona>=1.6.0
  • Run tests and check Travis
  • Pull onto v01.1 branch
  • Push to PyPi
  • Tag a release in git

Figure out the best way to handle --src/buf/dst-crs combinations

Consider the following situations:

  1. fio buffer --src-crs reads, buffers, and writes in the input CRS.
  2. fio buffer --src-crs --buf-crs buffers geometries in a different CRS but reprojects to the original CRS before writing.
  3. fio buffer --src-crs --buf-crs --dst-crs reads geometries in one CRS, buffers, in another, and reprojects to a third before writing.
  4. fio buffer --src-crs --dst-crs reads and buffers geometries in one CRS but reprojects to another before writing.
  5. fio buffer --buf-crs --dst-crs buffers in one and writes to another.

Item 4 should probably buffer in the --dst-crs?

Coveralls badge

Probably worth waiting at least 24 hours before trying to fix. The first post-migration test on Travis just ran, so it might take a bit for Travis to fully recognize the ownership change.

Unittests

Travis can build and test if the tests interact directly with the CLI command instead of through fio.

Support for feature sequences?

@geowurster this is awesome. We've talked about it elsewhere, but I want to mention it here, too: I'd love to see support for fio-cat's feature sequences so that we can have unlimited pipe fun like

$ fio cat example.shp | \
> fio buffer --distance 10 | \
> fio buffer --distance "-10" | \
> fio collect | \
> geojsonio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.