Metadata-Version: 2.0
Name: breaks
Version: 0.1.0
Summary: calculate bins on spatial data
Home-page: https://github.com/fitnr/breaks
Author: fitnr
Author-email: contact@fakeisthenewreal.org
License: GPL
Keywords: gis geodata chloropleth
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Operating System :: OS Independent
Requires-Dist: click (>=6.2,<7)
Requires-Dist: fiona (>=1.6.0,<2.0)
Requires-Dist: fionautil (>=0.5.1,<0.6.0)
Requires-Dist: numpy (>=1.10.4,<1.11)
Requires-Dist: pysal (>=1.11.0,<1.12)
Requires-Dist: scipy (>=0.15.1,<0.20)

breaks
======

Command line tool for adding data classes to geodata files.

Built on top of `Fiona <http://toblerity.org/fiona/README.html>`__ and
`Pysal <http://pysal.readthedocs.org/en/latest/>`__
`mapclassify <http://pysal.org/1.2/library/esda/mapclassify.html>`__.

Install
-------

Requires `GDAL <http://gdal.org>`__. `Numpy <http://www.numpy.org>`__
and Pysal will be installed if not available.

::

    pip install breaks

These are the breaks
--------------------

Add quintile bins on 'fieldname':

::

    breaks data.shp fieldname data_binned.shp

This writes a file called ``data_binned.shp`` which is a copy of
``data.shp``, but with an additional ``bin`` field, which contains a
number from 0 to 4 (it will contain ``NULL`` values for rows with
missing data).

Add decile bins on 'fieldname':

::

    breaks -k 10 data.shp fieldname data_binned.json

Add five
`Fisher-Jenks <https://en.wikipedia.org/wiki/Jenks_natural_breaks_optimization>`__
bins on 'fieldname':

::

    breaks --method fisher_jenks data.json fieldname data_binned.json

Add decile bins on 'fieldname' to a field called 'mybin':

::

    breaks --bin-field mybin data.json fieldname data_binned.json

Add custom bins on 'fieldname':

::

    breaks --bins 50,75,150,250,500 data.json fieldname data_binned.json

(Give the upper-bounds as a comma-separated list.)

::

    Usage: breaks [OPTIONS] input data-field output

      Write a geodata file with bins based on a data field

    Options:
      -m, --method METHOD    Binning method:
                             equal_interval
                             fisher_jenks
                             jenks_caspall
                             jenks_caspall_forced
                             jenks_caspall_sampled
                             max_p_classifier
                             maximum_breaks
                             natural_breaks
                             quantiles (default)
      -b, --bin-field FIELD  name of new field
      -k COUNT               Number of bins (default: 5)
      -B, --bins TEXT        Comma-separated list of breaks (a series of upper-
                             bounds)
      --version              Show the version and exit.
      --help                 Show this message and exit.

License
-------

Copyright 2016 Neil Freeman. Available under the GNU Public License.


