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

tinshift

v0.1.1

Published

Tinshift module to transform coordinats using TIN mesh

Downloads

3

Readme

tinshift

Tinshift module to transform coordinates using TIN mesh.

Minimal 2D Triangulated Irregular Network based transformation implementation based on input structure of https://proj.org/en/9.3/operations/transformations/tinshift.html

Installation

This package is hosted on npm so you can install it with npm

npm i tinshift

Use

Import module class and function

import {TinShift, sliceIntoChunks} from 'tinshift';

Create configuration object based on the Proj Tinshift. the example below uses triangles created in the Delaunator package:

const tinshift_config = {name: "tinshift", 
                        fallback_strategy: "nearest_side",
                        transformed_components: [ "horizontal" ],
                        vertices_columns: [ "source_x", "source_y", "target_x", "target_y" ],
                        triangles_columns: [ "idx_vertex1", "idx_vertex2", "idx_vertex3"],
                        vertices: vertices,
                        triangles: sliceIntoChunks(delaunay.triangles)} ;  

Create the tinshift transformer

this.transformer = new TinShift(tinshift_config);

Use the transformer to convert coordinates ([x, y]) from source system to target system

transformer.forward([2, 49]);
// [2.1, 49.1]

How it works

The TinShift class creates two OpenLayers Vector Sources (using source and target vertices) and uses the R-Tree spatial index to find the relevant triangle for a given coordinate. The barymetric coordinates are then calculated for this point and used together with the target triangle vertices to interpolate the target coodinate. The transformer also offers an inverse version which uses the target coordinate to find the equivalent coordinate in the source sytem.

Development status (as of Jan 2024)

This is the first working version of my first NPM/JS package, created for use with the OpenLayers extension Tinmap.

It will be continually tested and improved. Open to hints and tips form the community.