Skip to content

Commit

Permalink
feat: Merge pull request #11 from pelias/greenkeeper-update-all
Browse files Browse the repository at this point in the history
Update all dependencies 🌴
  • Loading branch information
orangejulius committed Aug 8, 2016
2 parents 3894327 + 6090a39 commit bc8f080
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function PolygonLookup( featureCollection ){
* `undefined`.
*/
PolygonLookup.prototype.search = function search( x, y ){
var bboxes = this.rtree.search( [ x, y, x, y ] );
var bboxes = this.rtree.search( { minX: x, minY: y, maxX: x, maxY: y } );
var pt = [ x, y ];
for( var ind = 0; ind < bboxes.length; ind++ ){
var polyObj = this.polygons[ bboxes[ ind ].polyId ];
Expand Down
36 changes: 18 additions & 18 deletions lib/polygon_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@
* `minX, minY, maxX, maxY` format.
*/
function getBoundingBox( poly ){
var firstPt = poly[ 0 ];
var bbox = [
firstPt[ 0 ], firstPt[ 1 ],
firstPt[ 0 ], firstPt[ 1 ]
];
var firstPt = poly[0];
var bbox = {
minX: firstPt[0],
minY: firstPt[1],
maxX: firstPt[0],
maxY: firstPt[1]
};

for( var ind = 1; ind < poly.length; ind++ ){
var pt = poly[ ind ];
var pt = poly[ind];

var x = pt[ 0 ];
if( x < bbox[ 0 ] ){
bbox[ 0 ] = x;
}
else if( x > bbox[ 2 ] ){
bbox[ 2 ] = x;
var x = pt[0];
if( x < bbox.minX ){
bbox.minX = x;
} else if( x > bbox.maxX ){
bbox.maxX = x;
}

var y = pt[ 1 ];
if( y < bbox[ 1 ] ){
bbox[ 1 ] = y;
}
else if( y > bbox[ 3 ] ){
bbox[ 3 ] = y;
var y = pt[1];
if( y < bbox.minY ){
bbox.minY = y;
} else if( y > bbox.maxY ){
bbox.maxY = y;
}
}

Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
"elasticsearch": ">=1.1.1"
},
"dependencies": {
"point-in-polygon": "0.0.0",
"rbush": "1.3.4",
"through2": "^0.6.3"
"point-in-polygon": "1.0.1",
"rbush": "2.0.1",
"through2": "^2.0.1"
},
"devDependencies": {
"jshint": "2.5.11",
"jshint": "2.9.2",
"tape": "^4.6.0",
"tap-spec": "^4.1.1",
"precommit-hook": "^3.0.0",
"tap-spec": "^0.2.0",
"tape": "^2.13.4",
"semantic-release": "^4.3.5"
},
"pre-commit": [
Expand Down
6 changes: 3 additions & 3 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ tape( 'getBoundingBox() finds correct bounding boxes.', function ( test ){
var testCases = [
{
poly: [ [ 2, 2 ], [ 6, 4 ], [ 4, 7 ] ],
bbox: [ 2, 2, 6, 7 ]
bbox: { minX: 2, minY: 2, maxX: 6, maxY: 7}
},
{
poly: [ [ 0, 0 ], [ 2, 1 ], [ 3, -1 ], [ 5, 1 ], [ 6, 4 ], [ 3, 5 ] ],
bbox: [ 0, -1, 6, 5 ]
bbox: { minX: 0, minY: -1, maxX: 6, maxY: 5}
},
{
poly: [ [ 2, 1 ], [ 3, 0 ], [ 4, 3 ], [ 0, 5 ], [ 1, -3 ] ],
bbox: [ 0, -3, 4, 5 ]
bbox: { minX: 0, minY: -3, maxX: 4, maxY: 5}
}
];

Expand Down

0 comments on commit bc8f080

Please sign in to comment.