Home

Awesome

cogran.js

CoGran - A command line tool for combining data of different spatial granularity

CoGran allows a spatial re-organization of geodata containing quantitative (statistical) information due to the fact that this is often not given in identical spatial units (like postal code districts, wards, or urban districts). Based on five different methods correlations between e.g. election results and income can be visualized. Recommendations for choosing the most suitable method for your data sets will follow. CoGran

Note: Project is still under development.

Installation

To install cogran.js you need to clone the repository first.

git clone https://github.com/berlinermorgenpost/cogran.git

Now you have to install all dependencies for the application. You need node.js 5.0 or higher.

cd /path/to/cogran
npm install

Using the link command, we install cogran globally, so that you can run it from every folder:

npm link

Usage Examples

Note: Only use GeoJSON files with WGS84 (EPSG: 4326) as coordinate system

1. Simple Area Weighting

  weights the attribute value by the area of intersection between source and target file <br> <br> SimpleAreaWeighting

    for absolute values: <br>

cogran -d -i path/input.geojson -t path/target.geojson -o path/output.geojson --attr attributeName

    Example:

cogran -d -i testdata/berlin/kriminalitaet_bezirksregionen.geojson -t testdata/berlin/447_lor_planungsraeume.geojson -o testdata/berlin/arealWeighting_kriminalitaet_bezirksregionenToPlanungsraeume.geojson --attr Alle_2012

    for relative & average values: <br>

cogran -d -i path/input.geojson -t path/target.geojson -o path/output.geojson --attr attributeName --mode arealWeightingRelative

    Example:

cogran -d -i testdata/hamburg/wohnflaecheProEW_Stadtteile.geojson -t testdata/hamburg/7_bezirke.geojson -o testdata/hamburg/arealWeightingRelative_wohnflaeche_stadtteileToBezirke.geojson --attr WFl_m2 --mode arealWeightingRelative

2. Attribute Weighting

  weights the attribute value by an additional attribute of the target file (e.g. population) <br>   AttributeWeighting

    for absolute values: <br>

cogran -d -i path/input.geojson -t path/target.geojson -o path/output.geojson --attr attributeName --weight weightingAttribute --mode attributeWeighting

    Example:

cogran -d -i testdata/berlin/kriminalitaet_bezirksregionen.geojson -t testdata/Berlin/zugezogene_planungsraeume.geojson -o testdata/berlin/attributeWeighting_kriminalitaet_bezirksregionenToPlanungsraeume.geojson --attr Alle_2012 --weight Einwohner --mode attributeWeighting

    for relative & average values: <br>

cogran -d -i path/input.geojson -t path/target.geojson -o path/output.geojson --attr attributeName --weight weightingAttribute --mode attributeWeightingRelative

    Example:

cogran -d -i testdata/hamburg/wohnflaecheProEW_Stadtteile.geojson -t testdata/hamburg/einwohner_bezirke.geojson -o testdata/hamburg/attributeWeightingRelative_wohnflaeche_stadtteileToBezirke.geojson --attr WFl_m2 --weight Insgesamt --mode attributeWeightingRelative

3. Binary Dasymetric Weighting

  additional control zones are used to mask out areas. Polygons (e.g. inhabited areas) get binary value [1]<br>   BinaryDasymetricWeighting

  Note: polygons of mask have to be listed in a single dataset of a multipart polygon - dissolve as needed beforehand

    for absolute values: <br>

cogran -d -i path/input.geojson -t path/target.geojson -o path/output.geojson --attr attributeName --mask path/binarymask.geojson --mode binaryDasymetricWeighting

    Example:

cogran -d -i testdata/berlin/kriminalitaet_bezirksregionen.geojson -t testdata/berlin/447_lor_planungsraeume.geojson -o testdata/berlin/binaryDasymetricWeighting_kriminalitaet_bezirksregionenToPlanungsraeume.geojson --attr Alle_2012 --mask testdata/berlin/wohnbloecke.geojson --mode binaryDasymetricWeighting

    for relative & average values: <br>

cogran -d -i path/input.geojson -t path/target.geojson -o path/output.geojson --attr attributeName --mask path/binarymask.geojson --mode binaryDasymetricWeightingRelative

    Example:

cogran -d -i testdata/hamburg/wohnflaecheProEW_Stadtteile.geojson -t testdata/hamburg/7_bezirke.geojson -o testdata/hamburg/binaryDasymetricWeightingRelative_wohnflaeche_stadtteileToBezirke.geojson --attr WFl_m2 --mask testdata/hamburg/bebauteFlaeche.geojson --mode binaryDasymetricWeightingRelative

4. N-Class Dasymetric Weighting

  additional control zones with percentage values of an attribute (e.g. share of the population) are used to weight the input attribute<br>   NClassDasymetricWeighting

  Note: percentage values have to be listed in an attribute called 'percentage'

    for absolute values: <br>

cogran -d -i path/input.geojson -t path/target.geojson -o path/output.geojson --attr attributeName --mask path/nclassmask.geojson --mode nClassDasymetricWeighting

    Example:

cogran -d -i testdata/berlin/kriminalitaet_bezirksregionen.geojson -t testdata/berlin/447_lor_planungsraeume.geojson -o testdata/berlin/nClassDasymetricWeighting_kriminalitaet_bezirksregionenToPlanungsraeume.geojson --attr Alle_2012 --mask testdata/berlin/wohnbloecke.geojson --mode nClassDasymetricWeighting

    for relative & average values: <br>

cogran -d -i path/input.geojson -t path/target.geojson -o path/output.geojson --attr attributeName --mask path/nclassmask.geojson --mode nClassDasymetricWeightingRelative

    Example:

cogran -d -i testdata/hamburg/wohnflaecheProEW_Stadtteile.geojson -t testdata/hamburg/7_bezirke.geojson -o testdata/hamburg/nClassDasymetricWeightingRelative_wohnflaeche_stadtteileToBezirke.geojson --attr WFl_m2 --mask testdata/hamburg/einwohner_statistischeGebiete.geojson --mode nClassDasymetricWeightingRelative

5. Linear Regression

  a linear correlation between an independent variable (e.g. area size) and a dependent variable (the attribute value) is used to estimate the attribute value<br>   LinearRegression

  Note: additional classes have to be listed in an attribute called 'class'<br>   ...and please note that negative attribute values may result due to missing endpoints of linear regression line<br>

    for absolute values: <br>

cogran -d -i path/input.geojson -t path/target.geojson -o path/output.geojson --attr attributeName --mask path/nclassmask.geojson --mode linearRegression

    Example:

cogran -d -i testdata/berlin/kriminalitaet_bezirksregionen.geojson -t testdata/berlin/447_lor_planungsraeume.geojson -o testdata/berlin/linearRegression_kriminalitaet_bezirksregionenToPlanungsraeume.geojson --attr Alle_2012 --mask testdata/berlin/wohnbloecke.geojson --mode linearRegression

Options

You can specify these options (you can also see the options if you run CoGran):

cogran

Todos

Credits