Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

colonel-mercator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colonel-mercator - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

24

lib/merc_res.js
var r_utils = require('mapnik-omnivore/lib/utils');
module.exports.get_resolution = function(metadata, maxRes, snapping, callback) {
var EPSLN = 1.0e-10;

@@ -11,20 +10,9 @@ var cellSize = metadata.raster.pixelSize.map(function(r) {

var validSpatRef = r_utils.getSpatialResolutions();
var spatialRes;
var spatialRes = r_utils.getValidSpatialResolutions(validSpatRef, cellSize[0]);
var snapRes, snapSpatialRes;
if (snapping) {
snapRes = spatialRes[spatialRes.length - 1] - EPSLN;
snapSpatialRes = r_utils.getValidSpatialResolutions(validSpatRef, snapRes);
// Insurance agains recursive resampling
if (spatialRes[spatialRes.length - 1] !== snapSpatialRes[snapSpatialRes.length - 1]) {
throw new Error('Cellsize is over threshold');
}
// Set cellsize to resolution @ mapnik-omnivore threshold - EPSLN
if (snapping !== false) {
spatialRes = r_utils.getValidSpatialResolutions(validSpatRef, cellSize[0], snapping);
cellSize = [
snapSpatialRes[snapSpatialRes.length - 1],
snapSpatialRes[snapSpatialRes.length - 1]
validSpatRef[spatialRes.length],
validSpatRef[spatialRes.length]
];

@@ -48,3 +36,3 @@ }

z: z,
thresh: validSpatRef[Math.min(z + upzoom, validSpatRef.length -1)]
thresh: validSpatRef[Math.min(z + upzoom, validSpatRef.length - 1)]
}

@@ -51,0 +39,0 @@ });

{
"name": "colonel-mercator",
"version": "0.0.1",
"version": "0.1.0",
"main": "./index",

@@ -16,3 +16,3 @@ "engines": {

"dependencies": {
"mapnik-omnivore": "^6.4.0",
"mapnik-omnivore": "^7.0.0",
"minimist": "^1.1.0",

@@ -19,0 +19,0 @@ "split": "^0.3.3"

# colonel-mercator
[![Build Status](https://travis-ci.org/mapbox/colonel-mercator.svg)](https://travis-ci.org/mapbox/colonel-mercator)[![Coverage Status](https://coveralls.io/repos/mapbox/colonel-mercator/badge.svg?branch=master&service=github)](https://coveralls.io/github/mapbox/colonel-mercator?branch=master)
Gets raster pixel resolutions, and optionally snaps them to `mapnik-omnivore` tiling thresholds.

@@ -3,0 +6,0 @@ Also, generates "metatile" zooms - the tile sizes at which a given input resolution would be over a size threshold based on an "upzoom" (the resolution of zoom levels "up")

Sorry, the diff of this file is not supported yet

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