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

world-cities-json

v1.0.1

Published

A JSON dataset of world cities sourced from SimpleMaps World Cities Database, including geographic coordinates and administrative information, with a script to generate data from a CSV source.

Downloads

345

Readme

world-cities-json

An NPM module that contains a JSON array of world cities sourced from the SimpleMaps World Cities Database, created by the team at Jet Set Expert.

Features

  • JSON array of world cities with the following fields:
    • city: The name of the city/town as a Unicode string (e.g. Goiânia).
    • city_ascii: city as an ASCII string (e.g. Goiania).
    • lat: The latitude of the city/town.
    • lng: The longitude of the city/town.
    • country: The name of the city/town's country.
    • iso2: The alpha-2 iso code of the country.
    • iso3: The alpha-3 iso code of the country.
    • admin_name: The name of the highest level administration region of the city/town (e.g. a US state or Canadian province).

Sample JSON

[
  {
    "city": "Tokyo",
    "city_ascii": "Tokyo",
    "lat": "35.6897",
    "lng": "139.6922",
    "country": "Japan",
    "iso2": "JP",
    "iso3": "JPN",
    "admin_name": "Tōkyō",
    "capital": "primary",
    "population": "37732000",
    "id": "1392685764"
  },
  {
    "city": "Jakarta",
    "city_ascii": "Jakarta",
    "lat": "-6.1750",
    "lng": "106.8275",
    "country": "Indonesia",
    "iso2": "ID",
    "iso3": "IDN",
    "admin_name": "Jakarta",
    "capital": "primary",
    "population": "33756000",
    "id": "1360771077"
  },
  ...

Installation

npm install cities-json

Usage

const { cities } = require("cities-json");

console.log(cities);

Generating the cities.json file

To generate the cities.json file from a source CSV file, follow these steps:

  1. Download the desired CSV file from the SimpleMaps World Cities Database.
  2. Place the CSV file in the /data directory and name it "worldcities.csv" or use the --source command line option to provide a custom path.
  3. Run the generate.js script:
node src/generate.js [--source path/to/your/csv]

Source and License

Data is sourced from the SimpleMaps World Cities Database and is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) license.

Links & Resources

Jet Set Expert
cities-json on GitHub
world-cities-json on NPM
world-cities-json on Aliyun
world-cities-json on TAONPM
world-cities-json on jsDlivr
world-cities-json on Snyk
world-cities-json on Libraries.io
world-cities-json on RunKit
world-cities-json on npm trends
world-cities-json on Package Phobia
world-cities-json on Skypack
world-cities-json on CNPM
world-cities-json on githubmemory
world-cities-json on npm.io
world-cities-json on Pkg Stats

Related Packages

airports-json on GitHub
airports-json on NPM