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

dline

v1.0.6

Published

JavaScript library for interpolating and generating contours ## Istallation use npm to install **dline** in node.js ``` npm i dline ``` or CDN to include **dline** in browser ``` <script src="https://unpkg.com/[email protected]/dist/dline.min.js"

Downloads

16

Readme

dline

JavaScript library for interpolating and generating contours

Istallation

use npm to install dline in node.js

 npm i dline

or CDN to include dline in browser

 <script src="https://unpkg.com/[email protected]/dist/dline.min.js"></script>

Documentation

Converters

Helper methods for converting formats

ascToArray and pointGridToArray

Converting string Esri ASCII grid or GeoJSON pointgird to dline array {grid,latCellSize,longCellSize,bbox,noData}

 dline.ascToArray(asc)
 dline.pointGridToArray(geoJson,z)

z - the property name, default 'value'

pointsToArray

Converting GeoJSON points to [[lat1,long1,z1],[lat2,long2,z2]...]

 dline.pointsToArray(geoJson,z)

z - the property name, default 'value'

Interpolation

dline uses the IDW method as interpolation. There is also an experimental function of using a mask to calculate a unique weight in each cell of the output grid

 dline.IDW(points, cellSize, options);

Arguments

  • points - reference point array [[lat1,long1,z1],[lat2,long2,z2]...]
  • cellSize - [latCellSize,longCellSize] only for degrees or value for degrees or meters units
  • options - additional optional settings

Options

  • bbox - default [0,0], can be an ordinary bbox like [minLong, minLat, maxLong, maxLat] or [longPercent, latPercent], in this case increases the size of the grid by longPercent,latPercent from extreme points
  • units - default ["meters","meters"], can be [cellSizeUnits,distanceUnits], where cellSizeUnits - output grid cell size, distanceUnits - units of distance in IDW method. If you set only "degrees" it equal ["degrees","degrees"], with meters as well
  • exponent - default 2, exponent of distance in IDW method
  • mask - the grid to adjust the weight of each point in each cell, {grid,latCellSize,longCellSize,bbox,noData}, converting from GeoJSON or Esri ASCII, see converters
  • boundaries - using only with mask, array of reference values which increases or decreases weight by some x value if the mask cell differs from the cell lying on the path to the desired value, [[value1,x1],[value2,x2]...]

Example

const  points = [
	[55.98, 92.76, 4],
	[56.02, 92.76, 7],
	[56.09, 92.74, 2],
	[56.02, 92.79, 18],
	[55.97, 92.67, 4]
];
const  mask = dline.ascToArray(await  fetch('./some_asc_file.asc').then(res  =>  res.text()));
const  grid = dline.IDW(points, 100, { bbox: [10, 10], exponent:  3, units: ['meters', 'degrees'], mask, boundaries: [[20, 0.2], [-50, 0.1]] });

Isolines and Isobands

Uses Marching squares algorithm for generating contours. Return GeoJSON.

 dline.isolines(grid,breaks)
 dline.isobands(grid,breaks)

Arguments

  • grid - grid that the dline.IDW method returns. If you whant to use GeoJSON pointgrid or Esri ASCII, see converters
  • breaks - array of contour values, [v1,v2,v3...]

Example

const  points = // some random points
const  bands = dline.isobands(dline.IDW(points,500),[1,2,3,4,5])