
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
japan-train-data
Advanced tools
A circular object of train data for Japan including translations & station geocoding
Choo choo.
A circular object of train data for Japan including translations & station geocoding and a tool to generate it. Access train data by prefecture, by lines, or by stations.
yarn add japan-train-data
import { prefectures, lines, stations } from 'japan-train-data'
console.log(prefectures.find(({ id }) => id === 13))
/*
{
id: 13,
name: { ja: '東京都', en: 'Tokyo' },
lines: [
{
id: 11301,
name: [Object],
lat: 35.39507962341528,
lng: 139.4302441326313,
zoom: 10,
stations: [Object],
prefecture: [Circular],
},
...
],
}
*/
console.log(lines.find(({ id }) => id === 11302))
/*
{
id: 11302,
name: {
ja: 'JR山手線',
en: 'JR Yamanote Line',
},
lat: 35.69302730762992,
lng: 139.73522275686264,
zoom: 12,
stations: [
{
id: 1130201,
name: [Object],
location: [Object],
lines: [Object],
prefecture: [Object],
},
{
id: 1130202,
name: [Object],
location: [Object],
lines: [Object],
prefecture: [Object],
},
...
],
prefecture: {
id: 13,
name: { ja: '東京都', en: 'Tokyo' },
lines: [[Object], [Circular], [Object]],
},
}
*/
console.log(stations.find(({ prefecture: { id } }) => id === 13))
/*
{
id: 1130101,
name: { ja: '東京', en: 'Tokyo' },
location: {
lat: 35.681391,
lng: 139.766103,
countryCode: { en: 'JP', ja: 'JP' },
postalCode: {
en: '100-0005',
ja: '100-0005',
},
administrativeArea1: {
en: 'Tōkyō-to',
ja: '東京都',
},
locality1: {
en: 'Chiyoda-ku',
ja: '千代田区',
},
sublocality1: {
en: 'Marunouchi',
ja: '丸の内',
},
sublocality2: {
en: '1 Chome',
ja: '1丁目',
},
sublocality3: { en: '9', ja: '9' },
sublocality4: { en: '1', ja: '1' },
},
lines: [
{ id: 11301, name: [Object] },
{ id: 11302, name: [Object] },
{ id: 11308, name: [Object] },
...
],
prefecture: {
id: 13,
name: { ja: '東京都', en: 'Tokyo' },
lines: [[Object], [Object], [Object]],
},
}
*/
Sure. data/raw-data.json.
First clone the project:
git clone https://github.com/adieuadieu/japan-train-data.git
Set up your environment with Google Cloud keys. To generate the data you need API access to Google's Translation and Geocoding APIs.
echo GCP_PROJECT=your-gcp-project-id-here >> .env
GCP_API_KEY=your-google-maps-api-key-here >> .env
GCP_KEYFILE=./gcp-keyfile.json >> .env
Then to start generating data:
yarn generate
FAQs
A circular object of train data for Japan including translations & station geocoding
The npm package japan-train-data receives a total of 0 weekly downloads. As such, japan-train-data popularity was classified as not popular.
We found that japan-train-data demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.