boundingbox
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -123,2 +123,19 @@ 'use strict' | ||
BoundingBox.prototype.toGeoJSON = function () { | ||
return { | ||
type: 'Feature', | ||
properties: {}, | ||
geometry: { | ||
'type': 'Polygon', | ||
'coordinates': [[ | ||
[ this.bounds.minlat, this.bounds.minlon ], | ||
[ this.bounds.maxlat, this.bounds.minlon ], | ||
[ this.bounds.maxlat, this.bounds.maxlon ], | ||
[ this.bounds.minlat, this.bounds.maxlat ], | ||
[ this.bounds.minlat, this.bounds.minlon ] | ||
]] | ||
} | ||
} | ||
} | ||
BoundingBox.prototype.toLeaflet = function () { | ||
@@ -125,0 +142,0 @@ return L.latLngBounds( |
@@ -5,3 +5,3 @@ { | ||
"description": "Implements bounding boxes with usual functions like intersects. Can convert from/to Leaflet bounds and GeoJSON.", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "BoundingBox.js", | ||
@@ -8,0 +8,0 @@ "directories": { |
@@ -67,2 +67,5 @@ # bounding-box | ||
## Method toGeoJSON() | ||
Returns the bounding box as GeoJSON feature. | ||
## Method toLeaflet() | ||
@@ -69,0 +72,0 @@ Returns the bounding box as L.latLngBounds object |
@@ -187,2 +187,11 @@ var assert = require('assert') | ||
it('toGeoJSON()', function(done) { | ||
var expected = {"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[48,16],[49,16],[49,17],[48,49],[48,16]]]}} | ||
assert.deepEqual(expected, bounds1.toGeoJSON()) | ||
done() | ||
}) | ||
if(typeof L != 'undefined') | ||
@@ -189,0 +198,0 @@ it('toLeaflet()', function(done) { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
87889
1519
82
0