1.1.1 • Published 10 years ago
dot-density v1.1.1
Install
npm install -g dot-density for CLI or npm install --save dot-density for use as library.
CLI
cat someCensusData.geojson | dot-density --population POP10 --sampleRate 0.1API
FeaturePopulationCallback
Parameters
featureFeature A geojson feature
Returns Number The feature's population
index
Produce dot density from population polygons
Parameters
dataFeature or FeatureCollection an inputoptionsobjectoptions.populationString or FeaturePopulationCallback the property key or accessor function providing each feature's population.options.sampleRatenumber Number of dots per person (optional, default1)options.stochasticboolean If true, then use a weighted dice roll to decide wwhether to add a point when population * sampleRate yields a fractional value. (optional, defaultfalse)
Examples
var dots = require('dot-density')
var points = dots(featureCollection, { population: 'POP10' })
console.log(points) // array of Point featuresReturns FeatureCollection A dot density FeatureCollection