all the cities
v3.1.0
世界上所有138,398个城市至少有1000名居民,在一个大型JSON阵列中,该阵列准备在MongoDB进口进行geoSpatialSearch
。
来自1000个NPM软件包的城市,该软件包又来自geonames.org数据。
在nodejs.org上下载节点并安装它,如果还没有。
npm install all-the-cities --save
const cities = require ( 'all-the-cities' ) ;
cities . filter ( city => city . name . match ( 'Albuquerque' ) ) ;
/*
[{
cityId: '5454711',
name: 'Albuquerque',
country: 'US',
altCountry: '',
muni: '',
muniSub: '',
featureClass: 'P',
featureCode: 'PPLA2',
adminCode: 'NM',
population: 545852,
loc: {
type: 'Point',
coordinates: [-106.65114, 35.084]
}
}, {
cityId: '5476960',
name: 'Los Ranchos de Albuquerque',
country: 'US',
altCountry: '',
muni: '',
muniSub: '',
featureClass: 'P',
featureCode: 'PPL',
adminCode: 'NM',
population: 6024,
loc: {
type: 'Point',
coordinates: [-106.6428, 35.16199]
}
}]
*/
id - Id of the city ( same in openWeatherMap )
name
altName
country
featureCode
adminCode
population
loc: { type : 'Point' , coordinates : [ 0 , 0 ] }
for * * GEO JSON data ** , a particular format is needed in MongoDB Schema as written in loc field above
npm install
npm test
没有任何
麻省理工学院