boundingbox
Advanced tools
Comparing version 0.0.5 to 0.0.6
'use strict' | ||
var GeoJSONBounds = require('geojson-bounds') | ||
// define L, if Leaflet is not available (not not confuse Linter) | ||
@@ -33,2 +35,14 @@ if (typeof L === 'undefined') { | ||
// GeoJSON detected | ||
if (bounds.type === 'Feature') { | ||
var b = GeoJSONBounds.extent(bounds) | ||
bounds = { | ||
minlat: b[0], | ||
minlon: b[1], | ||
maxlat: b[2], | ||
maxlon: b[3] | ||
} | ||
} | ||
if ('bounds' in bounds) { | ||
@@ -134,3 +148,3 @@ bounds = bounds.bounds | ||
[ this.bounds.maxlat, this.bounds.maxlon ], | ||
[ this.bounds.minlat, this.bounds.maxlat ], | ||
[ this.bounds.minlat, this.bounds.maxlon ], | ||
[ this.bounds.minlat, this.bounds.minlon ] | ||
@@ -137,0 +151,0 @@ ]] |
{ | ||
"dependencies": {}, | ||
"name": "boundingbox", | ||
"description": "Implements bounding boxes with usual functions like intersects. Can convert from/to Leaflet bounds and GeoJSON.", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"main": "BoundingBox.js", | ||
@@ -10,2 +9,5 @@ "directories": { | ||
}, | ||
"dependencies": { | ||
"geojson-bounds": "*" | ||
}, | ||
"devDependencies": { | ||
@@ -12,0 +14,0 @@ "browserify": "*", |
@@ -26,2 +26,3 @@ # bounding-box | ||
* A L.latLng object (using Leaflet) | ||
* A GeoJSON feature | ||
@@ -28,0 +29,0 @@ Example: |
@@ -82,2 +82,14 @@ var assert = require('assert') | ||
it('create from GeoJSON', function(done) { | ||
var expected = {"minlat":48,"minlon":16,"maxlat":49,"maxlon":17} | ||
var input = {"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[48,16],[49,16],[48.5,16.5],[49,17],[48,17],[48,16]]]}} | ||
assert.deepEqual( | ||
expected, | ||
new BoundingBox(input).bounds | ||
) | ||
done() | ||
}) | ||
if(typeof L != 'undefined') | ||
@@ -190,3 +202,3 @@ it('create from Leaflet L.latLngBounds', function(done) { | ||
var expected = {"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[48,16],[49,16],[49,17],[48,49],[48,16]]]}} | ||
var expected = {"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[48,16],[49,16],[49,17],[48,17],[48,16]]]}} | ||
@@ -193,0 +205,0 @@ assert.deepEqual(expected, bounds1.toGeoJSON()) |
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
88553
1539
83
1
2
+ Addedgeojson-bounds@*
+ Added@types/geojson@7946.0.16(transitive)
+ Addedgeojson-bounds@1.0.4(transitive)