Skip to content

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

Notifications You must be signed in to change notification settings

funkeinteraktiv/cogran

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

SimpleAreaWeighting

    for absolute values:

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:

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)
  AttributeWeighting

    for absolute values:

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:

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]
  BinaryDasymetricWeighting

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

    for absolute values:

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:

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
  NClassDasymetricWeighting

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

    for absolute values:

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:

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
  LinearRegression

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

    for absolute values:

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
  • --disaggregate, -d - Use (dis)aggregate mode
  • --input, -i - path and name of the input geojson that will be used for aggregation/disaggregation
  • --target, -t - path and name of the target geojson
  • --output, -o - path and name of the output geojson
  • --attr - The attribute that will be used (if you wish to reorganize several attributes at once use --attr "attributeName1; attributeName2")
  • --mode, -m - Possible values: arealWeightingRelative, attributeWeighting, attributeWeightingRelative, binaryDasymetricWeighting, binaryDasymetricWeightingRelative, nClassDasymetricWeighting, nClassDasymetricWeightingRelative, linearRegression
  • --mask - path and name of the geojson with ancillary information
  • --weight - The attribute from target geojson that is used for weighting

Todos

  • decrease runtime for calculations
  • add recommendation
  • add link to CoGran-Paper
  • complete GUI

Credits

  • HCU HafenCity Universität Hamburg, Berliner Morgenpost. Unterstützt von der Volkswagen-Stiftung

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published