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

turf

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf

a node.js library for performing geospatial operations with geojson

  • 2.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.8K
decreased by-38.27%
Maintainers
1
Weekly downloads
 
Created
Source

turf

Version Badge Build Status Gitter chat

A modular geospatial engine written in JavaScript

turfjs.org


Turf is a JavaScript library for spatial analysis. It includes traditional spatial operations, helper functions for creating GeoJSON data, and data classification and statistics tools. Turf can be added to your website as a client-side plugin, or you can run Turf server-side with Node.js (see below).

##Installation

In Node.js:

npm install turf

In browser:

Download the minified file, and include it in a script tag. This will expose a global variable named "turf".

<script src="turf.min.js" charset="utf-8"></script>

Browserify:

All of Turf's functions can also be installed as separate modules. This works well with tools like browserify where you want to install only the code you need. It also allows you to mix and match modules. This is the recommended usage pattern for most production environments. For example, to install the point and buffer modules use:

npm install turf-point turf-buffer

###Data in Turf

Turf uses GeoJSON for all geographic data. Turf expects the data to be standard WGS84 longitude, latitude coordinates. Check out geojson.io for a tool to easily create this data.

Most Turf functions work with GeoJSON features. These are are pieces of data that represent a collection of properties (ie: population, elevation, zipcode, etc.) along with a geometry. GeoJSON has several geometry types such as:

  • Point
  • LineString
  • Polygon

Turf provides a few geometry functions of its own. These are nothing more than simple (and optional) wrappers that output plain old GeoJSON. For example, these two methods of creating a point are functionally equivalent:

var point1 = turf.point([0, 0]);

var point2 = {
  type: 'Feature',
  geometry: {
    type: 'Point',
    coordinates: [0, 0]
  },
  properties: {}
};

##Functions

####geometry

Build Status point

Build Status linestring

Build Status polygon

Build Status featurecollection

####joins

Build Status inside

Build Status within

Build Status tag

####data Build Status remove

Build Status filter

Build Status sample

####measurement Build Status distance

Build Status area

Build Status nearest

Build Status bbox-polygon

Build Status envelope

Build Status extent

Build Status square

Build Status size

Build Status center

Build Status centroid

Build Status point-on-surface

Build Status midpoint

Build Status bearing

Build Status destination

Build Status line-distance

Build Status along

####interpolation

Build Status tin

Build Status planepoint

Build Status isolines

Build Status isobands

####grids

Build Status point-grid

Build Status square-grid

Build Status hex-grid

Build Status triangle-grid

####classification Build Status quantile

Build Status jenks

Build Status reclass

####aggregation Build Status average

Build Status median

Build Status sum

Build Status min

Build Status max

Build Status count

Build Status deviation

Build Status variance

Build Status aggregate

####transformation Build Status buffer

Build Status bezier

Build Status simplify

Build Status union

Build Status merge

Build Status intersect

Build Status erase

Build Status convex

Build Status concave

####misc Build Status flip

Build Status explode

Build Status combine

Build Status is-clockwise

Build Status kinks

Keywords

FAQs

Package last updated on 23 Mar 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