Socket
Socket
Sign inDemoInstall

turf-count

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf-count

turf count module


Version published
Weekly downloads
103
decreased by-0.96%
Maintainers
1
Weekly downloads
 
Created
Source

turf-count

Build Status

Calculates the number of points that fall within a set of polygons.

Install

npm install turf-count

API

count(polygonCollection, pointCollection, countProperty)

  • polygonCollection should be a FeatureCollection of Polygons
  • pointCollection should be a FeatureCollection of Points
  • countProperty is the property in the returned FeatureCollection that records the count of points in each polygon.

Example

var point = require('turf-point')
var polygon = require('turf-polygon')
var featurecollection = require('turf-featurecollection')

var poly1 = polygon([[[0,0],[10,0],[10,10], [0,10]]])
var poly2 = polygon([[[10,0],[20,10],[20,20], [20,0]]])
var polyFC = featurecollection([poly1, poly2])
var pt1 = point(5,5, {population: 200})
var pt2 = point(1,3, {population: 600})
var ptFC = featurecollection([pt1, pt2])

var counted = count(polyFC, ptFC, 'pt_count')

console.log(counted)

Keywords

FAQs

Package last updated on 30 May 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc