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 🙏

© 2026 – Pkg Stats / Ryan Hefner

geo-intersection-util

v1.0.3

Published

Point of intersection defined by its offset from the centerline and distance along the centerline

Readme

geo-intersection-util

A lightweight TypeScript/JavaScript utility for calculating the perpendicular intersection of a point (e.g., a golf shot or geographic location) to a given centerline path. Supports distance and directional analysis (left/right/center) and works in both frontend and backend environments.


✨ Features

  • Compute perpendicular intersection from a geographic point to a path
  • Get distance (in meters) and side (left/right/center)
  • Accepts centerline in "lng lat" string format
  • Pure TypeScript with JS compatibility
  • Lightweight, no external dependencies

Installation

npm install geo-intersection-util

🚀 Quick Start

TypeScript

import { Intersection } from "geo-intersection-util";

const center =
  "88.426709 22.579435, 88.430032 22.581458, 88.432886 22.582901, 88.437578 22.580801";
const point = "88.433217 22.581856";
const forward = "88.438367 22.580495";

const intersection = new Intersection();
const result = intersection.getInterSection(center, point, forward);

console.log(result);

JavaScript

const { Intersection } = require("geo-intersection-util");

const center =
  "88.426709 22.579435, 88.430032 22.581458, 88.432886 22.582901, 88.437578 22.580801";
const point = "88.433217 22.581856";
const forward = "88.438367 22.580495";

const intersection = new Intersection();
const result = intersection.getInterSection(center, point, forward);

console.log(result);

🧩 API Reference

getInterSection(centerLine: string, point: string, forwardPoint: string): IntersectionResult | undefined

Returns the intersection point on the centerline, the distance from the given point to the centerline (in meters), and the side relative to the centerline.

Parameters

  • centerLine (string): A comma-separated string of "lng lat" pairs representing the path.
  • point (string): The shot or location point in "lng lat" format.
  • forwardPoint (string): A "lng lat" point to help orient the centerline.

Return

{
  intersectionLatLng: { lat: number; lng: number };
  distance: number; // in meters
  side: "left" | "right" | "center" | null;
}

📐 Units

  • Distance is returned in meters.
  • You can convert it to yards: yards = meters * 1.09361

🧪 Example Use Case

Perfect for:

  • Golf shot dispersion analysis
  • Road/path mapping
  • Navigation systems
  • GIS-based tools

📝 License

MIT © 2025 Mayank Anand

📬 Author & Support

Mayank Anand
Email: [email protected]

Contributing

💡 Have suggestions? I'm always open to feedback! Feel free to write to me or submit a request to improve accuracy or add new features.