6.5.0 • Published 3 days ago

@turf/intersect v6.5.0

Weekly downloads
142,394
License
MIT
Repository
github
Last release
3 days ago

@turf/intersect

intersect

Takes two polygon or multi-polygon geometries and finds their polygonal intersection. If they don't intersect, returns null.

Parameters

Examples

var poly1 = turf.polygon([[
  [-122.801742, 45.48565],
  [-122.801742, 45.60491],
  [-122.584762, 45.60491],
  [-122.584762, 45.48565],
  [-122.801742, 45.48565]
]]);

var poly2 = turf.polygon([[
  [-122.520217, 45.535693],
  [-122.64038, 45.553967],
  [-122.720031, 45.526554],
  [-122.669906, 45.507309],
  [-122.723464, 45.446643],
  [-122.532577, 45.408574],
  [-122.487258, 45.477466],
  [-122.520217, 45.535693]
]]);

var intersection = turf.intersect(poly1, poly2);

//addToMap
var addToMap = [poly1, poly2, intersection];

Returns (Feature | null) returns a feature representing the area they share (either a Polygon or MultiPolygon). If they do not share any area, returns null.


This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.

Installation

Install this module individually:

$ npm install @turf/intersect

Or install the Turf module that includes it as a function:

$ npm install @turf/turf
airsiders-mapping-tool@skyraptor/leaflet.pm@infinitebrahmanuniverse/nolb-_turidgis_leaflet.pm@everything-registry/sub-chunk-941osm-edit-bundleoverpass-frontendoverpass-layeroffline-country-or-place-locatorol-elevation-parserpolyunionpg-cadastrethermodbbertin@carto/react-workers@cesium-extends/measure@dianahilton/leaflet.pmbusiness-map-giscadastre-pg@bencevans/xyz-intersect@deck.gl-community/editable-layers@bmap-turf/turfxx-onemap-biz-uixx-ic-map-uiyymap-turfunl-corenebula.glreact-cismapreact-cismap-experimentalrectangle-gridrescape-osmtilestrata-warmertilestrata-s3trafimage-mapsshape2geohashthing-it-ifctf-leaflet-freedrawtext-to-map@kragoth235/leaflet-freedrawevictions-dashboardfaunadb-geo@loudsrl/turfcountry-locator@geoman/leaflet-geoman-free@nsc-earth-v2/measure@nsc-earth-2/calculation@nsc-earth-2/measuregame-worldmap-generator@naivemap/mapbox-gl-polygon-morpher@nebula.gl/edit-modes@nebula.gl/layers@ngageoint/geopackage@ngageoint/geopackage-pbf-js@nightshifts.inc/geometry@nightshifts.inc/world-generator@nickcis/geohash-poly@nifty10m/mapbox-gl-draw-mode-collectiongisviewer-vue2-cesiumgisviewer-vue3-arcgis@norfield/core@keys2design/carto-react-workersic-map-uicsv-wkt-linkeoxc@ragone/edit-modesheremap@plasmastrapi/geometry@seated/leaflet.pm@seasketch/geoprocessing@turf/hex-grid@turf/triangle-grid@turf/turf@zalastax/nolb-_turluke.glleaflet-draw-shapesleaflet-geodrawleaflet.pmleaflet.pm-forkedleaflet.pm-measure-pathleaflet.pm-snapignore@webgeodatavore/leaflet.pmm-gis@varlab-ucf/nebula.gl@varlab-ucf/nebulagl-edit-modes@varlab-ucf/nebulagl-layers@vuemap/district-clusterminimongo-syncminimongoagentmapsmcalzado-react-workersmpilot-ui
7.0.0-alpha.115

3 days ago

7.0.0-alpha.114

2 months ago

7.0.0-alpha.113

3 months ago

7.0.0-alpha.111

3 months ago

7.0.0-alpha.110

4 months ago

7.0.0-alpha.1

7 months ago

7.0.0-alpha.2

7 months ago

7.0.0-alpha.0

1 year ago

6.5.0

3 years ago

6.4.0

3 years ago

6.3.0

3 years ago

6.2.0

3 years ago

6.2.0-alpha.3

3 years ago

6.2.0-alpha.2

4 years ago

6.2.0-alpha.0

4 years ago

6.2.0-alpha.1

4 years ago

6.1.3

6 years ago

6.1.2

6 years ago

6.1.1

6 years ago

6.1.0

6 years ago

6.0.1

6 years ago

5.1.6

6 years ago

5.1.5

6 years ago

5.1.1

6 years ago

5.1.0

6 years ago

5.0.6

6 years ago

5.0.5

6 years ago

5.0.4

6 years ago

5.0.0

6 years ago

4.7.4

7 years ago

4.7.3

7 years ago

4.7.1

7 years ago

4.7.0

7 years ago

4.6.0

7 years ago

4.5.2

7 years ago

4.5.1

7 years ago

4.4.0

7 years ago

4.3.0

7 years ago

4.2.0

7 years ago

4.1.0

7 years ago

4.0.2

7 years ago

3.14.0

7 years ago

3.13.0

7 years ago

3.10.0

7 years ago

3.7.5

7 years ago

3.7.3

7 years ago

3.7.2

7 years ago

3.7.1

7 years ago

3.7.0

7 years ago

3.6.3

7 years ago

3.6.2

7 years ago

3.5.3

7 years ago

3.5.2

8 years ago

3.3.3

8 years ago

3.0.18

8 years ago

3.0.16

8 years ago

3.0.15

8 years ago