New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

reproject-bbox

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reproject-bbox - npm Package Compare versions

Comparing version 0.12.0 to 0.13.0

6

package.json
{
"name": "reproject-bbox",
"version": "0.12.0",
"version": "0.13.0",
"description": "Reproject a Bounding Box",

@@ -50,6 +50,6 @@ "main": "reproject-bbox.js",

"devDependencies": {
"flug": "^2.6.0"
"flug": "^2.7.1"
},
"dependencies": {
"bbox-fns": "^0.11.0",
"bbox-fns": "^0.19.0",
"proj4-fully-loaded": "^0.2.0",

@@ -56,0 +56,0 @@ "proj4-merge": "^0.1.1"

@@ -70,2 +70,14 @@ # reproject-bbox

## split
reproject-bbox will automatically split bounding boxes where x=0 and y=0 before reprojecting and merging them back together. This can greatly improve accuracy for certain projections, especially ones around the poles. However, if you really want to turn it off, you can.
```js
reprojectBoundingBox({
bbox,
from: 3857,
split: false, // turn off automatic splitting
to: 4326
})
```
## proj4-fully-loaded dependency

@@ -72,0 +84,0 @@ This library depends on [proj4-fully-loaded](https://github.com/DanielJDufour/proj4-fully-loaded).

@@ -12,4 +12,5 @@ export default function reprojectBoundingBox({

proj4?: any,
split?: boolean | undefined,
to: number | string
}): [number, number, number, number];
const merge = require("proj4-merge");
const proj4 = require("proj4-fully-loaded");
const bboxMerge = require("bbox-fns/merge.js");
const bboxSplit = require("bbox-fns/split.js");
const reproject = require("bbox-fns/reproject.js");

@@ -12,3 +14,3 @@

function reprojectBoundingBox({ bbox, density, from, proj4: _proj4, to }) {
function reprojectBoundingBox({ bbox, density, from, proj4: _proj4, split = true, to }) {
if (from === 32767) throw new Error(CUSTOM_PROJECTION_ERROR.replace("{{%s}}", "from"));

@@ -28,3 +30,11 @@ if (to === 32767) throw new Error(CUSTOM_PROJECTION_ERROR.replace("{{%s}}", "to"));

return reproject(bbox, fwd, { density });
const bboxes = split ? bboxSplit(bbox, { x: [0], y: [0] }) : [bbox];
const bboxes_reprojected = bboxes.map((bbox) => {
return reproject(bbox, fwd, { density });
});
const merged = bboxMerge(bboxes_reprojected);
return merged;
}

@@ -31,0 +41,0 @@

Sorry, the diff of this file is too big to display

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