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

indian-states-cities-geolocation

v1.0.5

Published

Precise geolocation data for all Indian states and districts as par with 2026 data

Readme

Indian States and Cities geolocation

A comprehensive, lightweight, and offline package providing precise geolocation data (latitude and longitude) for all Indian states and their respective districts/cities.

Perfect for mapping features, weather applications, distance calculators, and dropdown populating in your frontend or backend applications.

Installation

Install the package via npm:

npm install indian-states-and-cities-geolocation

Usage

Import the functions into your project using ES6 module syntax:

import { 
  getAllStates, 
  getCitiesByState, 
  getGeolocation 
} from 'indian-states-and-cities-geolocation';

// 1. Get a list of all states
const states = getAllStates();
console.log(states); 
// Output: ['Himachal Pradesh', 'Punjab', ...]

// 2. Get all cities/districts for a specific state (Case-insensitive)
const punjabCities = getCitiesByState('punjab');
console.log(punjabCities);
/* Output: 
[
  { name: 'Amritsar', latitude: 31.63, longitude: 74.87 },
  { name: 'Barnala', latitude: 30.38, longitude: 75.55 },
  ...
]
*/

// 3. Get exact coordinates for a specific city
const coordinates = getGeolocation('Himachal Pradesh', 'Shimla');
console.log(coordinates);
// Output: { latitude: 31.1, longitude: 77.17 }

API Reference

getAllData()

Returns the entire raw JSON dataset.

getAllStates()

Returns an array of strings representing all the states available in the dataset.

getCitiesByState(stateName)

Returns an array of objects containing the name, latitude, and longitude of all districts/cities within the specified state.

  • stateName (String): The name of the state. (e.g., "Punjab"). This is case-insensitive.

getGeolocation(stateName, cityName)

Returns an object containing the latitude and longitude of the specified city. Returns null if the state or city is not found.

  • stateName (String): The name of the state.
  • cityName (String): The name of the city/district. Both arguments are case-insensitive.

Data Structure Example

The underlying data is structured as follows:

[
  {
    "state": "Punjab",
    "districts": [
      { "name": "Amritsar", "latitude": 31.63, "longitude": 74.87 }
    ]
  }
]

License

ISC


Author

Manas Bhatia