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

terraformer

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terraformer - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

2

package.json
{
"name": "terraformer",
"version": "0.1.4",
"version": "0.1.5",
"description": "Terraformer GIS Tools",

@@ -5,0 +5,0 @@ "main": "terraformer.js",

@@ -1,2 +0,2 @@

/*! Terraformer JS - 0.0.1 - 2013-02-02
/*! Terraformer JS - 0.0.1 - 2013-02-03
* https://github.com/geoloqi/Terraformer

@@ -473,2 +473,23 @@ * Copyright (c) 2013 Environmental Systems Research Institute, Inc.

function polygonContainsPoint(polygon, point) {
if (polygon && polygon.length) {
if (polygon.length === 1) { // polygon with no holes
return coordinatesContainPoint(polygon[0], point);
} else { // polygon with holes
if (coordinatesContainPoint(polygon[0], point)) {
for (var i = 1; i < polygon.length; i++) {
if (coordinatesContainPoint(polygon[i], point)) {
return false; // found in hole
}
}
return true;
} else {
return false;
}
}
} else {
return false;
}
}
/*

@@ -789,19 +810,3 @@ Internal: An array of variables that will be excluded form JSON objects.

if (primitive.coordinates && primitive.coordinates.length) {
if (this.coordinates && this.coordinates.length === 1) { // polygon with no holes
return coordinatesContainPoint(this.coordinates[0], primitive.coordinates);
} else { // polygon with holes
if (coordinatesContainPoint(this.coordinates[0], primitive.coordinates)) {
for (var i = 1; i < this.coordinates.length; i++) {
if (coordinatesContainPoint(this.coordinates[i], primitive.coordinates)) {
return false; // found in hole
}
}
return true;
} else {
return false;
}
}
}
return polygonContainsPoint(this.coordinates, primitive.coordinates);
};

@@ -845,3 +850,16 @@

};
MultiPolygon.prototype.contains = function(primitive) {
if (primitive.type !== "Point") {
throw new Error("Only points are supported");
}
for (var i = 0; i < this.coordinates.length; i++) {
if (polygonContainsPoint(this.coordinates[i], primitive.coordinates)) {
return true;
}
}
return false;
};
/*

@@ -1067,2 +1085,3 @@ GeoJSON Feature Class

exports.Tools.coordinatesContainPoint = coordinatesContainPoint;
exports.Tools.polygonContainsPoint = polygonContainsPoint;
exports.Tools.convexHull = convexHull;

@@ -1069,0 +1088,0 @@

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