
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
de9im is a Javascript library that provides spatial predicate
functions defined by the Dimensionally Extended Nine-Intersection Model
(DE-9IM) and works with GeoJSON objects. It can
test if two geometries have one of the following relationships: contains,
coveredby, covers, crosses, disjoint, equals, intersects,
overlaps, touches, within. It can be used client-side in a browser or
server-side with Node.js.
de9im depends on the Turf.js library for performing spatial
operations which must be also included for client-side processing since Turf.js
is not bundled with de9im.
<script src="https://unpkg.com/@turf/turf" charset="utf-8"></script>
<script src="https://unpkg.com/de9im" charset="utf-8"></script>
npm install de9im
const de9im = require('de9im');
Then call a predicate function on two geometries
const line = {'type': 'LineString', 'coordinates': [[0, 0], [1, 1], [2, 2]]};
const point = {'type': 'Point', 'coordinates': [1, 1]};
de9im.contains(line, point);
// = true
de9im.disjoint(line, point);
// = false
The de9im object has the following spatial predicate functions available:
contains
coveredby
covers
crosses
disjoint
equals
intersects
overlaps
touches
within
Each predicate takes two GeoJSON arguments and an optional boolean argument:
de9im.predicate(geojson1, geojson2, [error=true])
It returns true, false, or throws an exception if the geometry types provided
are not supported. If the optional argument error is false then unsupported
geometries return false instead of throwing an exception. Each predicate should
be interpreted as the first argument operating on the second. For example,
de9im.contains(line, point)
should be read as
line contains point?
The arguments for every predicate can be any GeoJSON type: Geometry,
Feature, GeometryCollection, FeatureCollection. All geometry types are
supported: Point, LineString, Polygon, MultiPoint, MultiLineString,
MultiPolygon. However, only homogenous geometries are supported in
collections. For example, a FeatureCollection can have points but can not mix
points and lines.
Each predicate has a unique combination of first and second argument geometries that it supports.
contains, covers
| 1st / 2nd | Point | Line | Polygon |
|---|---|---|---|
| Point | :heavy_check_mark: | :x: | :x: |
| Line | :heavy_check_mark: | :heavy_check_mark: | :x: |
| Polygon | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
coveredby, within
| 1st / 2nd | Point | Line | Polygon |
|---|---|---|---|
| Point | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Line | :x: | :heavy_check_mark: | :heavy_check_mark: |
| Polygon | :x: | :x: | :heavy_check_mark: |
crosses
| 1st / 2nd | Point | Line | Polygon |
|---|---|---|---|
| Point | :x: | :heavy_check_mark: | :heavy_check_mark: |
| Line | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Polygon | :heavy_check_mark: | :heavy_check_mark: | :x: |
disjoint, intersects
| 1st / 2nd | Point | Line | Polygon |
|---|---|---|---|
| Point | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Line | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Polygon | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
equals, overlaps
| 1st / 2nd | Point | Line | Polygon |
|---|---|---|---|
| Point | :heavy_check_mark: | :x: | :x: |
| Line | :x: | :heavy_check_mark: | :x: |
| Polygon | :x: | :x: | :heavy_check_mark: |
touches
| 1st / 2nd | Point | Line | Polygon |
|---|---|---|---|
| Point | :x: | :heavy_check_mark: | :heavy_check_mark: |
| Line | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Polygon | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
The following are some best practices on using de9im:
Data is expected to be in WGS 84 coordinates as per the GeoJSON standard.
Data with the GeoJSON bbox attribute already defined will process faster.
Data with complex geometries (e.g., self-intersections, repeated coordinates) may produce invalid results.
Data coordinates should be truncated to avoid unrealistically high precision (more than 6 decimal places).
To build and test the library locally:
npm install
npm test
Copyright (c) 2019 Daniel Pulido mailto:dpmcmlxxvi@gmail.com
Source code is released under the MIT License.
FAQs
DE-9IM spatial predicate library implemented in Javascript.
We found that de9im demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.