mxmap

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WXMAP_ERROR               = errors.New("请求失败")
	WXMAP_REQ_PARAMT_ERROR    = errors.New("缺少参数")
	WXMAP_JSON_MARSHA_ERROR   = errors.New("JSON生成错误")
	WXMAP_JSON_UNMARSHA_ERROR = errors.New("JSON解析错误")
	WXMAP_XML_MARSHA_ERROR    = errors.New("XML生成错误")
	WXMAP_XML_UNMARSHA_ERROR  = errors.New("XML解析错误")
	WXMAP_SIGN_CAL_ERROR      = errors.New("签名计算失败")
	WXMAP_SIGN_VERIFY_ERROR   = errors.New("签名验证失败")
)

请求参数错误

Functions

This section is empty.

Types

type AdInfo

type AdInfo struct {
	NationCode string   `json:"nation_code"` // 国家代码
	AdCode     string   `json:"adcode"`      //行政区划代码
	CityCode   string   `json:"city_code"`   //城市
	Name       string   // 行政区划名称
	Location   Location //行政区划中心点坐标
	Nation     string   // 国家
	Province   string   // 省 / 直辖市
	City       string   // 市 / 地级区 及同级行政区划
	// contains filtered or unexported fields
}

行政区划信息

type AddressComponent

type AddressComponent struct {
	Nation       string // 国家
	Province     string // 省
	City         string // 市
	District     string // 区,可能为空字串
	Street       string // 街道,可能为空字串
	StreetNumber string // 门牌,可能为空字串
}

地址部件,address不满足需求时可自行拼接

type AddressReference

type AddressReference struct {
	FamousArea   FamousArea `famous_area` // 知名区域,如商圈或人们普遍认为有较高知名度的区域
	Town         Town       // 知名区域,如商圈或人们普遍认为有较高知名度的区域
	LandmarkL1   FamousArea `json:"landmark_l_1"`  // 一级地标,可识别性较强、规模较大的地点、小区等
	LandmarkL2   FamousArea `json:"landmark_l2"`   // 二级地标,较一级地标更为精确,规模更小
	Street       FamousArea `json:"street"`        // 街道
	StreetNumber FamousArea `json:"street_number"` // 门牌
	Crossroad    FamousArea `json:"crossroad"`     // 交叉路口
	Water        FamousArea `json:"water"`         // 水系
}

坐标相对位置参考

type FamousArea

type FamousArea struct {
	Id       string   // 地点唯一标识
	Title    string   // 名称/标题
	Location Location //行政区划中心点坐标
	Distance float64  `json:"_distance"` // 此参考位置到输入坐标的直线距离
	DirDesc  string   `json:"_dir_desc"` //此参考位置到输入坐标的方位关系,如:北、南、内
}

知名区域,如商圈或人们普遍认为有较高知名度的区域

type FormattedAddresses

type FormattedAddresses struct {
	Recommend string //经过腾讯地图优化过的描述方式,更具人性化特点
	Rough     string // 大致位置,可用于对位置的粗略描述
}

位置描述

type GeoCoderResponse

type GeoCoderResponse struct {
	Status    int64  `json:"status"`     //状态码 0为正常 310请求参数信息有误 311Key格式错误 306请求有护持信息请检查字符串 110请求来源未被授权
	Message   string `json:"message"`    //状态说明
	RequestId string `json:"request_id"` //本次请求的唯一标识
	Result    Result `json:"result"`     //逆地址解析结果
}

逆地址解析应答

type Location

type Location struct {
	Lat float64 // 纬度
	Lng float64 // 经度
}

位置坐标

type Poi

type Poi struct {
	Id       string    // 地点唯一标识
	Title    string    // 名称/标题
	Address  string    // 地址
	Category string    // POI分类
	Location Location  //行政区划中心点坐标
	AdInfo   PosAdInfo `json:"ad_info"`   //行政区划信息
	Distance float64   `json:"_distance"` // 此参考位置到输入坐标的直线距离
}

type PosAdInfo

type PosAdInfo struct {
	AdCode   string `json:"adcode"` // 行政区划代码
	Province string // 省 / 直辖市
	City     string // 市 / 地级区 及同级行政区划
	// contains filtered or unexported fields
}

POI行政区划信息

type Result

type Result struct {
	Address            string             //地址描述
	FormattedAddresses FormattedAddresses `json:"formatted_addresses"` //位置描述
	AddressComponent   AddressComponent   `json:"address_component"`   //地址部件
	AdInfo             AdInfo             `json:"ad_info"`             //行政区划信息
	AddressReference   AddressReference   `json:"address_reference"`   //坐标相对位置参考
	PoiCount           int64              `json:"poi_count"`           //查询的周边poi的总数
	Pois               []Poi              `json:"pois"`                //POI数组,对象中每个子项为一个POI对象
}

逆地址解析结果

type Town

type Town struct {
	Id       string   // 地点唯一标识
	Title    string   // 名称/标题
	Location Location //行政区划中心点坐标
	Distance float64  `json:"_distance"` // 此参考位置到输入坐标的直线距离
	DirDesc  string   `json:"_dir_desc"` //此参考位置到输入坐标的方位关系,如:北、南、内
}

乡镇街道

type WxMap

type WxMap struct {
	// contains filtered or unexported fields
}

func New

func New(key string) (wx *WxMap)

创建微信支付对象

func (*WxMap) Geocoder

func (wx *WxMap) Geocoder(lat, lng float64, getPoi, poiOption string) (geoCoderResponse *GeoCoderResponse, err error)

逆地址解析 @param lat 纬度,必填 @param lng 经度,必填 @param getPoi 是否返回周边POI列表 1.返回;0不返回(默认),非必填 @param poiOption 用于控制POI列表

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL