turf-difference

WebJar for turf-difference

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

turf-difference
Last Version

Last Version

3.0.12
Release Date

Release Date

Type

Type

jar
Description

Description

turf-difference
WebJar for turf-difference
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/Turfjs/turf-difference

Download turf-difference

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/turf-difference/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>turf-difference</artifactId>
    <version>3.0.12</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/turf-difference/
implementation 'org.webjars.npm:turf-difference:3.0.12'
// https://jarcasting.com/artifacts/org.webjars.npm/turf-difference/
implementation ("org.webjars.npm:turf-difference:3.0.12")
'org.webjars.npm:turf-difference:jar:3.0.12'
<dependency org="org.webjars.npm" name="turf-difference" rev="3.0.12">
  <artifact name="turf-difference" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='turf-difference', version='3.0.12')
)
libraryDependencies += "org.webjars.npm" % "turf-difference" % "3.0.12"
[org.webjars.npm/turf-difference "3.0.12"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : jsts jar [1.1.2]
org.webjars.npm : turf-helpers jar [3.0.12,4)

Project Modules

There are no modules declared in this project.

DEPRECATED - replaced with @turf/difference

turf-difference

build status

Turf difference module

turf.difference(poly1, poly2)

Finds the difference between two Polygon|polygons by clipping the second polygon from the first.

Parameters

parameter type description
poly1 Feature.<Polygon> input Polygon feaure
poly2 Feature.<Polygon> Polygon feature to difference from poly1

Example

var poly1 = {
  "type": "Feature",
  "properties": {
    "fill": "#0f0"
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [-46.738586, -23.596711],
      [-46.738586, -23.458207],
      [-46.560058, -23.458207],
      [-46.560058, -23.596711],
      [-46.738586, -23.596711]
    ]]
  }
};
var poly2 = {
  "type": "Feature",
  "properties": {
    "fill": "#00f"
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [-46.650009, -23.631314],
      [-46.650009, -23.5237],
      [-46.509246, -23.5237],
      [-46.509246, -23.631314],
      [-46.650009, -23.631314]
    ]]
  }
};

var differenced = turf.difference(poly1, poly2);
differenced.properties.fill = '#f00';

var polygons = {
  "type": "FeatureCollection",
  "features": [poly1, poly2]
};

//=polygons

//=differenced

Returns Feature.<Polygon>, a Polygon feature showing the area of poly1 excluding the area of poly2

Installation

Requires nodejs.

$ npm install turf-difference

Tests

$ npm test
org.webjars.npm

turf

a fast and fully featured open gis engine written in javascript

Versions

Version
3.0.12