Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

world-cities-json

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

world-cities-json

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.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
90
increased by1185.71%
Maintainers
1
Weekly downloads
 
Created
Source

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.

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

airports-json on GitHub
airports-json on NPM

Keywords

FAQs

Package last updated on 29 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc