closest-feature
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,1 +0,1 @@ | ||
'use strict';Object.defineProperty(exports,'__esModule',{value:true});exports.default=closest;var _pointInPolygon=require('point-in-polygon');var _pointInPolygon2=_interopRequireDefault(_pointInPolygon);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function closest(point,features){var distance=Infinity;var result={};features.some(function(feature){if((0,_pointInPolygon2.default)(point,feature.geometry.coordinates[0])){result=feature.properties;return true}else{feature.geometry.coordinates[0].forEach(function(coord){var d=Math.abs(Math.pow(point[0]-coord[0],2)+Math.pow(point[1]-coord[1],2));if(d<distance){distance=d;result=feature.properties}})}});return result} | ||
'use strict';Object.defineProperty(exports,'__esModule',{value:true});exports.default=closest;var _pointInPolygon=require('point-in-polygon');var _pointInPolygon2=_interopRequireDefault(_pointInPolygon);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function closest(point,features){var distance=Infinity;var result={};features.some(function(feature){if(feature.geometry.type==='MultiPolygon'){feature.geometry.type='Polygon';feature.geometry.coordinates=feature.geometry.coordinates[0]}if((0,_pointInPolygon2.default)(point,feature.geometry.coordinates[0])){result=feature.properties;return true}else{feature.geometry.coordinates[0].forEach(function(coord){var d=Math.abs(Math.pow(point[0]-coord[0],2)+Math.pow(point[1]-coord[1],2));if(d<distance){distance=d;result=feature.properties}})}});return result} |
{ | ||
"name": "closest-feature", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "find the closest geojson feature (or the one the point is inside) from a point", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
129902