npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kartotherian/abaculus

v3.0.3-alpha.0

Published

stitches map tiles together for high-res exporting from tm2

Downloads

5

Readme

abaculus

a small block of stone, tile, glass, or other material used in the construction of a mosaic

or,

a library for creating static maps from tiles based on center or corner lng,lat coordinates. Uses node-mapnik to stitch tiles together.

Build Status

Build status

Looking to create high res images of maps? Abaculus was written for use in Mapbox Studio and you can use Mapbox Studio to create and export high resolution images -- see https://www.mapbox.com/guides/print/ for more information. You can even use that utility from the command line.

usage

Usage and example formatting below, or see the tests for a more robust example with a getTile function.

input:

scale: integer between 1-4 and sets resolution (scale: 1 is 72dpi, scale: 4, is 288dpi)

zoom: zoom level

[w, s, e, n]: the bounding box for the west (lat val), south (lng val), east (lat val), north (lng val) for the desired area

x: longitude coordinate

y: latitude coordinate

width and height: desired pixel bounds for a map with a center coordinate. Will be multiplied by scale to maintain resolution.

format (optional): png or jpeg, default is png.

quality (optional): when used with jpeg format, accepts 1-100 and defaults to 80. when used with png format, accepts 2-256 (# of colors to reduce the image to) and defaults to none.

tileSize (optional, defaults to 256): Specifies input size of tiles used in getTile function.

getTile: a function that returns a tile buffer (png or otherwise) and headers given z, x, y, and a callback, such as from tilelive-vector or this test function.

limit (optional): max width or height of generated image in pixels. Default is 19008.

// Calculate image bounds from W,S,E,N bounding box.
var params = {
	zoom: {zoom},
	scale: {scale}
    bbox: [{w}, {s}, {e}, {n}],
    format: {format},
    quality: {quality},
	tileSize: {tileSize},
    getTile: function(z, x, y, callback){
		// do something
		return callback(null, buffer, headers);
	},
	limit: {limit}
};

or

// Calculate image bounds from center lng,lat coordinates and
// pixel dimensions of final image (will be multipled by scale).
var params = {
	zoom: {zoom},
	scale: {scale}
    center: {
    	x: {x},
    	y: {y},
    	w: {width},
    	h: {height}
    },
    format: {format},
    quality: {quality},
	tileSize: {tileSize},
    getTile: function(z,x,y, callback){
		// do something
		return callback(null, buffer, headers);
	},
	limit: {limit}
};

usage:

abaculus(params, function(err, image, headers){
	if (err) return err;
	// do something with image
});

output:

an image of desired resolution for the selected area.