外观
lib-geo 库参考
原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793259306/FIN+5.3.1+lib-geo 中文整理基于 FIN 5.3.1
导读: 地理位置功能库
以下为 API 参考,保留英文以便对照源码;目录已列出(英文标题便于检索);概述已尽量中译。
目录(导读)
- lib
- meta
- docs
- funcs
- Overview
- Model
- geoCountryCode(name, checked: true)
- geoCountryName(code, checked: true)
- geoTz(val)
- geoUsStateCode(name, checked: true)
- geoUsStateName(code, checked: true)
概述(中译)
地理位置功能库
API 正文(英文)
docs
funcs
| geoCountryCode | Normalize a country name into its two letter ISO-3166 code |
| geoCountryName | Given a two ISO-3166 country code or country name, return a country name |
| geoTz | Given a dict/row that contains primary geo tags such as geoCountry, geoState, and geoCity return ideal timezone name |
| geoUsStateCode | Normalize a US state name into its standard two letter postal code |
| geoUsStateName | Given a two letter postal code or state name, return a US state name |
lib geo
Overview
The GeoExt is used to define the basic model of geographical information and geo-coding functions.
Model
The following are the key tags to assocaite a record with a geographic location:
geoAddr: full geographic addressgeoStreet: street number and namegeoCity: city namegeoState: region or US two-letter state codegeoCountry: ISO 3166-1 two letter country codegeoPostalCode: US zip code or country specific postal codegeoCoord: geographic coordinate as latitude, longitude
Here is an example of a site entity fully tricked out with geolocation tags:
dis: "White House"
site
area: 55,000 ft²
tz: "New_York"
weatherStationRef: <Weather in Washington, DC>
geoAddr: "1600 Pennsylvania Avenue NW, Washington, DC"
geoStreet: "1600 Pennsylvania Ave NW"
geoCity: "Washington D.C."
geoCountry: "US"
geoPostalCode: "20500"
geoState: "DC"
geoCoord: C(38.898,-77.037)def
func:geoCountryCode
geoCountryCode(name, checked: true)
Normalize a country name into its two letter ISO-3166 code. If the country is not recognized, then return null or throw exception based on checked flag.
meta
| def | func:geoCountryCode |
| is | func |
| lib | lib:geo |
| name | geoCountryCode |
supertypes
| feature | Feature namespace of definitions formatted as feature:name |
| func | Axon function |
def
func:geoCountryName
geoCountryName(code, checked: true)
Given a two ISO-3166 country code or country name, return a country name. If the country is not recognized, then return null or throw exception based on checked flag.
meta
| def | func:geoCountryName |
| is | func |
| lib | lib:geo |
| name | geoCountryName |
supertypes
| feature | Feature namespace of definitions formatted as feature:name |
| func | Axon function |
def
func:geoTz
geoTz(val)
Given a dict/row that contains primary geo tags such as geoCountry, geoState, and geoCity return ideal timezone name.
NOTE: if your city or country is not correctly modeled by this function then please let us know and we can update our database.
meta
| def | func:geoTz |
| is | func |
| lib | lib:geo |
| name | geoTz |
| overridable | ✓ |
supertypes
| feature | Feature namespace of definitions formatted as feature:name |
| func | Axon function |
def
func:geoUsStateCode
geoUsStateCode(name, checked: true)
Normalize a US state name into its standard two letter postal code. If the state is not recognized, then return null or throw exception based on checked flag.
meta
| def | func:geoUsStateCode |
| is | func |
| lib | lib:geo |
| name | geoUsStateCode |
supertypes
| feature | Feature namespace of definitions formatted as feature:name |
| func | Axon function |
def
func:geoUsStateName
geoUsStateName(code, checked: true)
Given a two letter postal code or state name, return a US state name. If the state is not recognized, then return null or throw exception based on checked flag.
meta
| def | func:geoUsStateName |
| is | func |
| lib | lib:geo |
| name | geoUsStateName |
supertypes
| feature | Feature namespace of definitions formatted as feature:name |
| func | Axon function |