Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pobing/mvgeo
Support iso3166 standard province geo code
https://github.com/pobing/mvgeo
Last synced: about 1 month ago
JSON representation
Support iso3166 standard province geo code
- Host: GitHub
- URL: https://github.com/pobing/mvgeo
- Owner: pobing
- Created: 2014-06-21T04:08:23.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-21T04:09:17.000Z (over 10 years ago)
- Last Synced: 2024-10-09T16:45:49.263Z (about 1 month ago)
- Language: Ruby
- Size: 117 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
##mvgeo
本文件的省市区代码遵循iso3166标准: http://zh.wikipedia.org/wiki/ISO_3166
功能点:
1.根据省市的 GeoID 获取省市名称
2.根据省市名称获取对应的 GeoID### Usage:
```
geo = Geo.new# Get Bejing Geocode
p geo.province_id('北京') # -> 1156110000
p geo.province_id('北京市') # -> 1156110000p geo.province_name('1156110000') #-> '北京市'
p geo.province_id('美国') # -> 1840000000
p geo.province_id('陕西') # ->1156610000
p geo.city_id('咸阳') # -> 1156610400
p geo.city_name('1156610400') # -> '咸阳市'# # Not exists id or name
p geo.province_id('北北京') # -> 0
p geo.province_name('asdsd') # -> ''```