andvab / geonames-bundle
Geonames组件。创建表并使用Geonames.org服务的数据进行填充
Requires
- symfony/symfony: >=2.6
This package is not auto-updated.
Last update: 2024-09-23 12:51:49 UTC
README
安装
使用composer安装组件
composer require andvab/geonames-bundle
或在composer.json中添加
{
require: {
"andvab/geonames-bundle": "*"
}
}
将组件添加到AppKernel.php
$bundles = array(
// ...
new Andvab\GeonamesBundle\AndvabGeonamesBundle(),
// ...
);
安装或更新数据库模式
console doctrine:schema:update --force
添加参数
path/to/project/app/config/parameters.yml
parameters:
...
andvab_geonames.feature_classes: [A,H,L,P,T,U,V]
此变量的默认值设置为:[A,H,L,P,T,U,V]。有关特征类值的更多信息,请参阅链接 - http://download.geonames.org/export/dump/
命令
1) 清空“alternate_names”表。
php app/console andvab_geonames:clear:alternatenames [ru uk ...]
在params中,您可以指定要删除的语言列表,如果未指定,则将完全清空该表(更快)。语言列表可在链接中查看 - http://download.geonames.org/export/dump/iso-languagecodes.txt 中的“Language”列
2) 完全清空“geonames”表
php app/console andvab_geonames:clear:locations
3) 更新“admin1_codes”表中的数据(行政区域名称)
php app/console andvab_geoname:update:admin1
4) 更新“admin2_codes”表中的数据(行政子区域名称)
php app/console andvab_geoname:update:admin2
5) 更新“alternate_names”表中的数据。
php app/console andvab_geoname:update:alternatenames [ru uk ...]
在参数中,您可以指定要更新的语言列表,如果未指定参数,则将完全更新该表(更长)。语言列表可在链接中查看 - http://download.geonames.org/export/dump/iso-languagecodes.txt 中的“Language”列
6) 更新“countries”表中的数据。
php app/console andvab_geonames:update:countries
7) 更新“geonames”表中的数据。
php app/console andvab_geonames:update:locations [ru ua ...]
在参数中,您可以指定要更新的国家列表,如果未指定参数,则将从国家表中获取列表,并更新每个国家。国家列表可在链接中查看 - http://download.geonames.org/export/dump/countryInfo.txt 中的“iso”列
有关表和字段描述表的更多信息,请参阅链接 - http://download.geonames.org/export/dump/