baidu

package
v0.0.0-...-74f83c4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// 地理编码服务
	GeocoderUrl = "http://api.map.baidu.com/geocoding/v3"
	// 全球逆地理编码服务Url
	ReverseGeocodingUrl = "http://api.map.baidu.com/reverse_geocoding/v3"
	// 普通IP定位
	IPLocationUrl = "http://api.map.baidu.com/location/ip"
	// 智能硬件定位
	LBSLocationUrl = "https://api.map.baidu.com/locapi/v2"
	// 天气
	WeatherUrl = "http://api.map.baidu.com/weather/v1/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaiduMapSDK

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

func DefaultBaiduMapSDK

func DefaultBaiduMapSDK(ak string) *BaiduMapSDK

func NewBaiduMapSDK

func NewBaiduMapSDK(ak, output, coordType, retCoordtype string) *BaiduMapSDK

func (*BaiduMapSDK) Geocoder

func (s *BaiduMapSDK) Geocoder(address string, city string) (*ls.Location, error)

func (*BaiduMapSDK) GeocoderParams

func (s *BaiduMapSDK) GeocoderParams(params *url.Values) (*ls.Location, error)

func (*BaiduMapSDK) GetWeatherNow

func (s *BaiduMapSDK) GetWeatherNow(adcode int64) (*ls.WeatherInfo, error)

func (*BaiduMapSDK) IPLocation

func (s *BaiduMapSDK) IPLocation(ip string) (*ls.IPPosition, error)

func (*BaiduMapSDK) IPLocationParams

func (s *BaiduMapSDK) IPLocationParams(params url.Values) (*ls.IPPosition, error)

func (*BaiduMapSDK) LBSLocation

func (s *BaiduMapSDK) LBSLocation(req *ls.LBSInfo) (*ls.LBSPosition, error)

func (*BaiduMapSDK) LBSLocationParams

func (s *BaiduMapSDK) LBSLocationParams(params LBSLocationReq) (*ls.LBSPosition, error)

todo: 未调用成功

func (*BaiduMapSDK) ReverseGeocoding

func (s *BaiduMapSDK) ReverseGeocoding(lng, lat float64) (*ls.Address, error)

func (*BaiduMapSDK) ReverseGeocodingParams

func (s *BaiduMapSDK) ReverseGeocodingParams(params url.Values) (*ls.Address, error)

type DataRes

type DataRes struct {
	Status int         `json:"status"`  // 返回结果状态值, 成功返回0,其他值请查看下方返回码状态表。	int
	Result interface{} `json:"result"`  // data数据
	Msg    string      `json:"message"` // 错误消息
}

type GeocoderRes

type GeocoderRes struct {
	Location      location `json:"location"`
	Precise       int64    `json:"precise"`
	Confidence    int64    `json:"confidence"`
	Comprehension int64    `json:"comprehension"`
	Level         string   `json:"level"`
}

type IPLocationRes

type IPLocationRes struct {
	Status  int     `json:"status"`
	Address string  `json:"address"`
	Content content `json:"content"`
	Msg     string  `json:"message"` // 错误消息
}

type LBSLocationReq

type LBSLocationReq struct {
	Key   string           `json:"key"`
	Src   string           `json:"src"`
	Prod  string           `json:"prod"`
	Ver   string           `json:"ver"`
	Trace bool             `json:"trace"`
	Body  []LBSRequestBody `json:"body"`
}

type LBSLocationRes

type LBSLocationRes struct {
	Status int     `json:"errcode"` // 返回结果状态值, 成功返回0,其他值请查看下方返回码状态表。	int
	Msg    string  `json:"msg"`     // 错误消息
	Result []*body `json:"body"`
}

type LBSRequestBody

type LBSRequestBody struct {
	Accesstype int    `json:"accesstype"`
	IMEI       string `json:"imei"`
	IMSI       string `json:"imsi"`
	CDMA       int    `json:"cdma"`
	Network    string `json:"network"`
	BTS        string `json:"bts"`
	SMAC       string `json:"smac"`
	ClientIP   string `json:"clientip"`
	Tel        string `json:"tel"`
	MMAC       string `json:"mmac"`
	CTime      string `json:"ctime"`
}

type LocationInfo

type LocationInfo struct {
	Country  string `json:"country"`
	Province string `json:"province"`
	City     string `json:"city"`
	Name     string `json:"name"` // 区县名称
	ID       string `json:"id"`   // 区县ID
}

type NowInfo

type NowInfo struct {
	Text      string `json:"text"`       // 天气现象
	Temp      int64  `json:"temp"`       // 温度
	FeelsLike int64  `json:"feels_like"` // 体感温度(℃)
	RH        int64  `json:"rh"`         // 相对湿度(%)
	WindClass string `json:"wind_class"` // 风力等级
	WindDir   string `json:"wind_dir"`   // 风向描述
	UpTime    string `json:"uptime"`
}

type ResultInfo

type ResultInfo struct {
	Location LocationInfo `json:"location"`
	Now      NowInfo      `json:"now"`
}

type ReverseGeocodingRes

type ReverseGeocodingRes struct {
	Location         location         `json:"location"`
	Business         string           `json:"business"`          // 坐标所在商圈信息,如 "人民大学,中关村,苏州街"。最多返回3个。
	FormattedAddress string           `json:"formatted_address"` // 结构化地址信息
	AddressComponent addressComponent `json:"addressComponent"`
	Pois             []*pois          `json:"pois"`
	Roads            []*roads         `json:"roads"`
	PoiRegions       []*poiRegions    `json:"poiRegions"`
	SematicDesc      string           `json:"sematic_description"` //当前位置结合POI的语义化结果描述
}

type WeatherResponse

type WeatherResponse struct {
	Status  int64      `json:"status"`
	Result  ResultInfo `json:"result"`
	Message string     `json:"message"`
}

Jump to

Keyboard shortcuts

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