Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

turf-max

Package Overview
Dependencies
Maintainers
8
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf-max

turf max module

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
8
Created
Source

turf-max

build status

turf max module

turf.max(polygons, points, inField, outField)

Calculates the maximum value of a field for points within a set of polygons.

Parameters

parametertypedescription
polygonsFeatureCollectiona FeatureCollection of Polygon features
pointsFeatureCollectiona FeatureCollection of Point features
inFieldstringthe field in input data to analyze
outFieldstringthe field in which to store results

Example

var polygons = turf.featurecollection([
  turf.polygon([[
    [101.551437, 3.150114],
    [101.551437, 3.250208],
    [101.742324, 3.250208],
    [101.742324, 3.150114],
    [101.551437, 3.150114]
  ]]),
  turf.polygon([[
    [101.659927, 3.011612],
    [101.659927, 3.143944],
    [101.913986, 3.143944],
    [101.913986, 3.011612],
    [101.659927, 3.011612]
  ]])
]);
var points = turf.featurecollection([
  turf.point([101.56105, 3.213874], {population: 200}),
  turf.point([101.709365, 3.211817], {population: 600}),
  turf.point([101.645507, 3.169311], {population: 100}),
  turf.point([101.708679, 3.071266], {population: 200}),
  turf.point([101.826782, 3.081551], {population: 300})]);

var aggregated = turf.max(
  polygons, points, 'population', 'max');

var result = turf.featurecollection(
  points.features.concat(aggregated.features));

//=result

Installation

Requires nodejs.

$ npm install turf-max

Tests

$ npm test

Keywords

FAQs

Package last updated on 06 Feb 2015

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