package tencent_map import "encoding/json" //#region 坐标转换参数 // TencentCoordinateChangeReq 坐标转换请求参数 type TencentCoordinateChangeReq struct { Key string `json:"key" binding:"required"` // 开发秘钥 Locations string `json:"locations" binding:"required"` // 预转换的坐标,支持批量转换, 格式:纬度前,经度后,纬度和经度之间用",“分隔,每组坐标之间使用”;"分隔; 批量支持坐标个数以HTTP GET方法请求上限为准 Type int `json:"type" binding:"required"` // 输入的locations的坐标类型,可选值: 1 GPS坐标2 sogou经纬度3 baidu经纬度4 mapbar经纬度6 sogou墨卡托 //Output string `json:"output"` // 返回格式:支持JSON/JSONP,默认JSON } // TencentCoordinateChangeRes 坐标转换返回参数 type TencentCoordinateChangeRes struct { Status int64 `json:"status"` //状态码,0为正常,其它为异常,详细请参阅状态码说明 Message string `json:"message"` // 对status的描述 Locations []*LocationsCoordinate `json:"locations"` // 坐标列 } type LocationsCoordinate struct { Lat json.Number `json:"lat"` // 纬度 Lng json.Number `json:"lng"` // 经度 } type LocationsCoordinateObj struct { Lat string `json:"lat"` // 纬度 Lng string `json:"lng"` // 经度 } //#endregion //#region 获取腾讯骑行计划 // TencentCyclingPlanningReq 获取骑行计划参数 type TencentCyclingPlanningReq struct { Key string `json:"key" binding:"required"` // 开发秘钥 From string `json:"from" binding:"required"` // 起点位置坐标,纬度在前,经度在后 from=39.915285,116.403857 To string `json:"to" binding:"required"` // 终点位置坐标,纬度在前,经度在后 from=39.915285,116.403857 } // TencentCyclingPlanningRes 获取骑行计划返回值 type TencentCyclingPlanningRes struct { Status int64 `json:"status"` //状态码,0为正常,其它为异常,详细请参阅状态码说明 Message string `json:"message"` // 对status的描述 Result map[string][]*Routers `json:"result"` // 搜索结果 } // Routers 骑行计划详细返回值 type Routers struct { Mode string `json:"mode"` // 方案交通方式,固定值:“EBICYCLING” Distance int64 `json:"distance"` // 方案整体距离,单位:米 Duration int64 `json:"duration"` // 方案估算时间,单位:分钟 Direction string `json:"direction"` // 方案整体方向 Polyline []json.Number `json:"polyline"` // 方案路线坐标点串 Steps interface{} `json:"steps"` // 路线步骤 } //#endregion //#region 地址转坐标解析 // AddressGeoCoderChangeRes 地址转坐标解析返回参数 type AddressGeoCoderChangeRes struct { Status int64 `json:"status"` //状态码,0为正常,其它为异常,详细请参阅状态码说明 Message string `json:"message"` // 对status的描述 Result *ResultDetail `json:"result"` // 搜索结果 } type ResultDetail struct { Title string `json:"title"` // 废弃 Location LocationsCoordinate `json:"location"` // 解析到的坐标 AddressComponents struct { Province string `json:"province"` // 省 City string `json:"city"` // 市 District string `json:"district"` // 区 Street string `json:"street"` // 街道 StreetNumber string `json:"street_number"` // 门派 } `json:"address_components"` // 解析后地址部件 AdInfo struct { AdCode string `json:"adcode"` // 行政区划代码 } `json:"ad_info"` // 行政区划 Similarity json.Number `json:"similarity"` // 下线 Deviation json.Number `json:"deviation"` // 下线 Reliability json.Number `json:"reliability"` // 可信度参考:值范围 1 <低可信> - 10 <高可信>我们根据用户输入地址的准确程度,在解析过程中,将解析结果的可信度(质量),由低到高,分为1 - 10级,该值>=7时,解析结果较为准确,<7时,会存各类不可靠因 Level json.Number `json:"level"` // 解析精度级别,分为11个级别,一般>=9即可采用(定位到点,精度较高) 也可根据实际业务需求自行调 } //#endregion //#region 坐标转地址 type Codes2AddressRes struct { Status int `json:"status"` Message string `json:"message"` RequestId string `json:"request_id"` Result Code2AddressResultDetail `json:"result"` } type Code2AddressResultDetail struct { Address string `json:"address"` // 以行政区划+道路+门牌号等信息组成的标准格式化地址 FormattedAddresses struct { Recommend string `json:"recommend"` // 推荐使用的地址描述,描述精确性较高 Rough string `json:"rough"` // 粗略位置描述 StandardAddress string `json:"standard_address"` // address } `json:"formatted_addresses"` // 结合知名地点形成的描述性地址,更具人性化特点 AddressComponent struct { Nation string `json:"nation"` // 国家 Province string `json:"province"` // 省 City string `json:"city"` // 市,如果当前城市为省直辖县级区划,city与district字段均会返回此城市 District string `json:"district"` // 区 Street string `json:"street"` // 道路 StreetNumber string `json:"street_number"` // 门牌 } `json:"address_component"` // 地址部件,address不满足需求时可自行拼接 AdInfo struct { NationCode string `json:"nation_code"` // 国家代码 Adcode string `json:"adcode"` // 行政区划代码 PhoneAreaCode string `json:"phone_area_code"` // CityCode string `json:"city_code"` // 城市代码 Name string `json:"name"` // 行政区划名称 Location LocationsCoordinate `json:"location"` // Nation string `json:"nation"` // 国家 Province string `json:"province"` // 省 / 直辖市 City string `json:"city"` // 市 District string `json:"district"` // 区 Distance int `json:"_distance"` } `json:"ad_info"` // 行政区划信息 AddressReference interface{} `json:"address_reference"` // 坐标相对位置参考,暂时忽略掉 PoiCount int `json:"poi_count"` // 查询的周边poi的总数,仅在传入参数get_poi=1时返回 Pois []struct { Id string `json:"id"` // 地点(POI)唯一标识 Title string `json:"title"` // 名称 Address string `json:"address"` // 地址 Category string `json:"category"` // 地点信息分类 Location LocationsCoordinate `json:"location"` AdInfo struct { Adcode string `json:"adcode"` // 行政区划代码 Province string `json:"province"` // 省 City string `json:"city"` //市 District string `json:"district"` // 区 } `json:"ad_info"` // 行政区划信息 Distance float64 `json:"_distance"` // 该POI/AOI到逆地址解析传入的坐标的直线距离 DirDesc string `json:"_dir_desc,omitempty"` // 该POI/AOI在逆地址解析传入的坐标的相对方位描述,包括:东、东南、南、西南、西、西北、北、东北、内(输入经纬度在AOI范围内) } `json:"pois"` Location LocationsCoordinate `json:"location"` } //#endregion //#region 行政区划获取 // AdministrativeDivision 获取全国的行政区划 //type AdministrativeDivision struct { // Status int `json:"status"` // Message string `json:"message"` // RequestId string `json:"request_id"` // DataVersion string `json:"data_version"` // 行政区划数据版本,便于您判断更新 // Result []*DistrictsList `json:"result"` // 全国行政区划 //} // //type DistrictsList struct { // Id string `json:"id"` // 行政区划唯一标识(adcode) // Name string `json:"name"` // 简称 // Level int `json:"level"` // 行政区划级别 // FullMame string `json:"fullname"` // 全称 // Pinyin []string `json:"pinyin"` // 拼音 // Location LocationsCoordinate `json:"location"` // 坐标 // DistrictsList []*DistrictsList `json:"districts"` //} // DistrictGetChildren 获取指定城市行政区划 type DistrictGetChildren struct { Status int `json:"status"` Message string `json:"message"` RequestId string `json:"request_id"` DataVersion string `json:"data_version"` Result [][]struct { Id string `json:"id"` Name string `json:"name"` Fullname string `json:"fullname"` Pinyin []string `json:"pinyin"` Location LocationsCoordinate `json:"location"` } `json:"result"` } type District struct { Adcode string `json:"adcode"` // 国家行政编码 Lng float64 `json:"lng"` Lat float64 `json:"lat"` CityCode string `json:"citycode"` // 电话区号 Level int `json:"level"` Name string `json:"name"` Districts []*District `json:"districts"` } //#endregion type Coordinate struct { Lng float64 `json:"lng"` Lat float64 `json:"lat"` }