Documentation
¶
Index ¶
- Constants
- Variables
- func GetCityByGPS(pos lbs.Coordinate) (city, province string, e error)
- func GetCityByIP(ip string) (province, city string, e error)
- func GetCityByPhone(phone string) (city, province, supplier string, e error)
- func GetGPSByCity(city string, province string) (pos lbs.Coordinate, e error)
- func IsZXS(province string) bool
- type CityByPhoneResult
- type CityGPSResult
- type CityNum
- type CityNumResult
- type GPSCityResult
- type IPAddressResult
- type Place
- type PlaceResult
- type Suggestion
- type SuggestionResult
Constants ¶
View Source
const ( AK = "FGV8C3GjFeAGstAa1INmabge" APIKEY = "98d278cdc3fdb4e71b1469bdfd144624" )
Variables ¶
View Source
var ZXS []string = []string{"北京市", "天津市", "重庆市", "上海市", "澳门特别行政区", "香港特别行政区"}
Functions ¶
func GetCityByGPS ¶
func GetCityByGPS(pos lbs.Coordinate) (city, province string, e error)
根据GPS获取城市
func GetCityByPhone ¶
根据手机号码获取城市
func GetGPSByCity ¶
func GetGPSByCity(city string, province string) (pos lbs.Coordinate, e error)
根据城市获取GPS
Types ¶
type CityByPhoneResult ¶
type CityGPSResult ¶
type CityNumResult ¶
type GPSCityResult ¶
type IPAddressResult ¶
type Place ¶
type Place struct { Name string `json:"name"` Uid string `json:"uid"` Location struct { Lat float64 `json:"lat"` Lng float64 `json:"lng"` } `json:"location"` Address string `json:"address"` }
func SearchCity ¶
SearchRegion在城市范围内根据关键字搜索实体,关键词之间是或的关系。
参数:
cur: 请求的页码,从1开始 ps: 每页的数量,不能超过20 keywords: 搜索关键词
func SearchPlace ¶
func SearchPlace(lat, lng float64, radius, cur, ps int, sortByDistence bool, keywords ...string) (places []Place, total int, e error)
SearchPlace根据关键字搜索附近的实体,关键词之间是或的关系。
参数:
lat,lng: 中心点,经纬度 radius: 半径,米 cur: 请求的页码,从1开始 ps: 每页的数量,不能超过20 sortByDistence: 是否按距离排序,如果为false,则根据百度地图的默认排序规则(貌似是根据热度排序) keywords: 搜索关键词
type PlaceResult ¶
type Suggestion ¶
type Suggestion struct { Name string `json:"name"` Uid string `json:"uid"` Location struct { Lat float64 `json:"lat"` Lng float64 `json:"lng"` } `json:"location"` City string `json:"city"` CityId string `json:"cityid"` District string `json:"district"` }
func SuggestionPlace ¶
func SuggestionPlace(region string, keyword string, coordinate ...float64) (sugestions []Suggestion, e error)
SuggestionPlace根据用户输入返回建议的结果。
参数:
region: 区域,例如"北京市" coordinate: 中心点,经纬度(先纬度后经度),如果传这两个值,则以此坐标为中心返回建议结果。 keyword: 搜索关键词
type SuggestionResult ¶
type SuggestionResult struct { Status int `json:"status"` Message string `json:"message"` Results []Suggestion `json:"result"` }
Click to show internal directories.
Click to hide internal directories.