Socket
Socket
Sign inDemoInstall

@turf/boolean-contains

Package Overview
Dependencies
Maintainers
9
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/boolean-contains

turf boolean-contains module


Version published
Maintainers
9
Created

What is @turf/boolean-contains?

@turf/boolean-contains is a module from the Turf.js library that provides geospatial analysis tools. This specific module is used to determine if one GeoJSON geometry contains another GeoJSON geometry.

What are @turf/boolean-contains's main functionalities?

Check if a Polygon contains another Polygon

This feature checks if one polygon contains another polygon. In this example, polygon1 contains polygon2, so the result is true.

const turf = require('@turf/turf');
const polygon1 = turf.polygon([[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]);
const polygon2 = turf.polygon([[[2, 2], [2, 8], [8, 8], [8, 2], [2, 2]]]);
const contains = turf.booleanContains(polygon1, polygon2);
console.log(contains); // true

Check if a Polygon contains a Point

This feature checks if a polygon contains a point. In this example, the polygon contains the point, so the result is true.

const turf = require('@turf/turf');
const polygon = turf.polygon([[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]);
const point = turf.point([5, 5]);
const contains = turf.booleanContains(polygon, point);
console.log(contains); // true

Check if a MultiPolygon contains a Polygon

This feature checks if a MultiPolygon contains a polygon. In this example, the MultiPolygon contains the polygon, so the result is true.

const turf = require('@turf/turf');
const multiPolygon = turf.multiPolygon([[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]], [[[20, 20], [20, 30], [30, 30], [30, 20], [20, 20]]]]);
const polygon = turf.polygon([[[2, 2], [2, 8], [8, 8], [8, 2], [2, 2]]]);
const contains = turf.booleanContains(multiPolygon, polygon);
console.log(contains); // true

Other packages similar to @turf/boolean-contains

Keywords

FAQs

Package last updated on 09 Aug 2024

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