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 🙏

© 2025 – Pkg Stats / Ryan Hefner

india-geo-state-finder

v1.0.1

Published

Finds the Indian state corresponding to a given latitude and longitude using GeoJSON data.

Readme

🇮🇳 @india-geo-state-finder Find the corresponding Indian State or Union Territory for any given Latitude and Longitude coordinate.

A fast, lightweight utility built on static GeoJSON data for quick, offline geospatial lookups within India, eliminating the need for external API calls.

🚀 Installation Install the package using npm:

Bash

npm install @india-geo-state-finder 💡 Quick Usage The package exports a single function, findState(lat, lon), which returns the state name or null if the coordinates fall outside any defined boundary.

Example: Finding the State of Maharashtra JavaScript

const findState = require('@india-geo-state-finder');

// Coordinates for Mumbai (Latitude: 18.9582, Longitude: 72.8321) const lat = 18.9582; const lon = 72.8321;

const state = findState(lat, lon);

console.log(state); // Output: 'Maharashtra'

if (state) { console.log(The coordinates fall within: ${state}); } else { console.log("The coordinates are outside India's boundaries."); } ES Module (ESM) Import If you are using modern Node.js or an ES Module environment ("type": "module" in package.json):

JavaScript

import findState from '@india-geo-state-finder';

// Coordinates for Chennai, Tamil Nadu const state = findState(13.0827, 80.2707); console.log(state); // Output: 'Tamil Nadu' ⚙️ How It Works This package performs a Point-in-Polygon (PIP) test using the following structure:

Static Data: It bundles a lightweight, comprehensive GeoJSON file containing the official boundaries of all Indian States and Union Territories.

Turf.js: It leverages the highly optimized geospatial algorithms from the Turf.js library to quickly check if the input point (lat, lon) falls inside the polygon of any state.

Result: It returns the state name from the matching feature's properties, making the lookup instantaneous and reliable without needing external service calls.

🤝 Contribution Contributions are welcome! If you find a bug, inaccuracy in the state boundaries, or want to suggest a feature:

Fork the repository.

Create your feature branch (git checkout -b feature/amazing-feature).

Commit your changes (git commit -m 'feat: added amazing feature').

Push to the branch (git push origin feature/amazing-feature).

Open a Pull Request.

📄 License Distributed under the MIT License. See LICENSE for more information.