_map

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(ctx context.Context, ak string) (*Client, error)

NewClient 创建实例化

func (*Client) GeocodingV3

func (c *Client) GeocodingV3(ctx context.Context, address string, notMustParams ...gorequest.Params) (*GeocodingV3Result, error)

GeocodingV3 地理编码服务 https://lbsyun.baidu.com/faq/api?title=webapi/guide/webservice-geocoding-base

func (*Client) LocationIp

func (c *Client) LocationIp(ctx context.Context, ip string, notMustParams ...gorequest.Params) (*LocationIpResult, error)

LocationIp 普通IP定位 https://lbsyun.baidu.com/index.php?title=webapi/ip-api

func (*Client) ReverseGeocodingV3

func (c *Client) ReverseGeocodingV3(ctx context.Context, location string, notMustParams ...gorequest.Params) (*ReverseGeocodingV3Result, error)

ReverseGeocodingV3 全球逆地理编码服务 https://lbsyun.baidu.com/faq/api?title=webapi/guide/webservice-geocoding-abroad-base

func (*Client) SetClientIP

func (c *Client) SetClientIP(clientIP string) *Client

SetClientIP 配置

func (*Client) SetLogFun

func (c *Client) SetLogFun(logFun gorequest.LogFunc)

SetLogFun 设置日志记录函数

func (*Client) TimezoneV1

func (c *Client) TimezoneV1(ctx context.Context, notMustParams ...gorequest.Params) (*TimezoneV1Result, error)

TimezoneV1 时区服务 location => 需查询时区的位置坐标 (纬度、经度),当前仅支持全球陆地坐标查询,海域坐标暂不支持。 coord_type => 请求参数中坐标的类型,wgs84即GPS经纬度,gcj02即国测局经纬度坐标,bd09ll即百度经纬度坐标,bd09mc即百度米制坐标 timestamp => 所需时间(用于判断夏令时)。以协调世界时 1970 年 1 月 1 日午夜以来的秒数表示(即Unix时间戳) https://lbsyun.baidu.com/faq/api?title=webapi/guide/timezone-base

func (*Client) WeatherAbroadV1

func (c *Client) WeatherAbroadV1(ctx context.Context, notMustParams ...gorequest.Params) (*WeatherAbroadV1Result, error)

WeatherAbroadV1 海外天气查询 https://lbsyun.baidu.com/faq/api?title=webapi/weather-abroad

func (*Client) WeatherV1

func (c *Client) WeatherV1(ctx context.Context, notMustParams ...gorequest.Params) (*WeatherV1Result, error)

WeatherV1 国内天气查询服务 https://lbsyun.baidu.com/index.php?title=webapi/weather

type GeocodingV3Response

type GeocodingV3Response struct {
	Status int64 `json:"status"`
	Result struct {
		Location struct {
			Lng float64 `json:"lng"`
			Lat float64 `json:"lat"`
		} `json:"location"`
		Precise       int64  `json:"precise"`
		Confidence    int64  `json:"confidence"`
		Comprehension int64  `json:"comprehension"`
		Level         string `json:"level"`
	} `json:"result"`
}

type GeocodingV3Result

type GeocodingV3Result struct {
	Result GeocodingV3Response // 结果
	Body   []byte              // 内容
	Http   gorequest.Response  // 请求
}

type LocationIpResponse

type LocationIpResponse struct {
	Address string `json:"address"` // 详细地址信息
	Content struct {
		AddressDetail struct {
			Province     string `json:"province"` // 省份
			City         string `json:"city"`     // 城市
			District     string `json:"district"`
			Street       string `json:"street"`
			StreetNumber string `json:"street_number"`
			CityCode     int64  `json:"city_code"` // 百度城市代码
			Adcode       string `json:"adcode"`
		} `json:"address_detail"`
		Address string `json:"address"` // 简要地址信息
		Point   struct {
			X string `json:"x"` // 当前城市中心点经度
			Y string `json:"y"` // 当前城市中心点纬度
		} `json:"point"`
	} `json:"content"`
	Status int `json:"status"`
}

type LocationIpResult

type LocationIpResult struct {
	Result LocationIpResponse // 结果
	Body   []byte             // 内容
	Http   gorequest.Response // 请求
}

type ReverseGeocodingV3Response

type ReverseGeocodingV3Response struct {
	Status int64 `json:"status"`
	Result struct {
		Location struct {
			Lng float64 `json:"lng"`
			Lat float64 `json:"lat"`
		} `json:"location"`
		FormattedAddress string `json:"formatted_address"`
		Business         string `json:"business"`
		AddressComponent struct {
			Country         string `json:"country"`
			CountryCode     int64  `json:"country_code"`
			CountryCodeIso  string `json:"country_code_iso"`
			CountryCodeIso2 string `json:"country_code_iso2"`
			Province        string `json:"province"`
			City            string `json:"city"`
			CityLevel       int64  `json:"city_level"`
			District        string `json:"district"`
			Town            string `json:"town"`
			TownCode        string `json:"town_code"`
			Distance        string `json:"distance"`
			Direction       string `json:"direction"`
			Adcode          string `json:"adcode"`
			Street          string `json:"street"`
			StreetNumber    string `json:"street_number"`
		} `json:"addressComponent"`
		Pois               []interface{} `json:"pois"`
		Roads              []interface{} `json:"roads"`
		PoiRegions         []interface{} `json:"poiRegions"`
		SematicDescription string        `json:"sematic_description"`
		CityCode           int64         `json:"cityCode"`
	} `json:"result"`
}

type ReverseGeocodingV3Result

type ReverseGeocodingV3Result struct {
	Result ReverseGeocodingV3Response // 结果
	Body   []byte                     // 内容
	Http   gorequest.Response         // 请求
}

type TimezoneV1Response

type TimezoneV1Response struct {
	Status     int64  `json:"status"`      // 本次API访问状态,如果成功返回0,如果失败返回其他数字。
	TimezoneId string `json:"timezone_id"` // 所在时区ID字符串
	DstOffset  int64  `json:"dst_offset"`  // 夏令时(Daylight Saving Time:DST)时间偏移秒数
	RawOffset  int64  `json:"raw_offset"`  // 坐标点位置时间较协调世界时偏移秒数
}

type TimezoneV1Result

type TimezoneV1Result struct {
	Result TimezoneV1Response // 结果
	Body   []byte             // 内容
	Http   gorequest.Response // 请求
}

type WeatherAbroadV1Response

type WeatherAbroadV1Response struct {
	Status int64 `json:"status"`
	Result struct {
		Location struct {
			Country  string `json:"country"`  // 国家名称
			Province string `json:"province"` // 省份名称
			City     string `json:"city"`     // 城市名称
			Name     string `json:"name"`     // 区县名称
			Id       string `json:"id"`       // 区县id
		} `json:"location"` // 地理位置信息
		Now 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"`   // 风向描述
			Prec1h    float64 `json:"prec_1h"`    // 1小时累计降水量(mm)
			Clouds    int64   `json:"clouds"`     // 云量(%)
			Vis       int64   `json:"vis"`        // 能见度(m)
			Aqi       int64   `json:"aqi"`        // 空气质量指数数值
			Pm25      int64   `json:"pm25"`       // pm2.5浓度(μg/m3)
			Pm10      int64   `json:"pm10"`       // pm10浓度(μg/m3)
			No2       int64   `json:"no2"`        // 二氧化氮浓度(μg/m3)
			So2       int64   `json:"so2"`        // 二氧化硫浓度(μg/m3)
			O3        int64   `json:"o3"`         // 臭氧浓度(μg/m3)
			Co        float64 `json:"co"`         // 一氧化碳浓度(mg/m3)
			Uptime    string  `json:"uptime"`     // 数据更新时间,北京时间
		} `json:"now"` // 实况数据
		Alert []struct {
			Type  string `json:"type"`  // 预警事件类型
			Level string `json:"level"` // 预警事件等级
			Title string `json:"title"` // 预警标题
			Desc  string `json:"desc"`  // 预警详细提示信息
		} `json:"alert"` // 气象预警数据
		Indexes []struct {
			Name   string `json:"name"`   // 生活指数中文名称
			Brief  string `json:"brief"`  // 生活指数概要说明
			Detail string `json:"detail"` // 生活指数详细说明
		} `json:"indexes"` // 生活指数数据
		Forecasts []struct {
			Date      string `json:"date"`       // 日期,北京时区
			Week      string `json:"week"`       // 星期,北京时区
			High      int64  `json:"high"`       // 最高温度(℃)
			Low       int64  `json:"low"`        // 最低温度(℃)
			WcDay     string `json:"wc_day"`     // 白天风力
			WcNight   string `json:"wc_night"`   // 晚上风力
			WdDay     string `json:"wd_day"`     // 白天风向
			WdNight   string `json:"wd_night"`   // 晚上风向
			TextDay   string `json:"text_day"`   // 白天天气现象
			TextNight string `json:"text_night"` // 晚上天气现象
		} `json:"forecasts"` // 预报数据
		ForecastHours []struct {
			Text      string  `json:"text"`       // 天气现象
			TempFc    int64   `json:"temp_fc"`    // 温度(℃)
			WindClass string  `json:"wind_class"` // 风力等级
			WindDir   string  `json:"wind_dir"`   // 风向描述
			Rh        int64   `json:"rh"`         // 相对湿度
			Prec1h    float64 `json:"prec_1h"`    // 1小时累计降水量(mm)
			Clouds    int64   `json:"clouds"`     // 云量(%)
			DataTime  string  `json:"data_time"`  // 数据时间
		} `json:"forecast_hours"` // 未来24小时逐小时预报
	} `json:"result"`
	Message string `json:"message"`
}

type WeatherAbroadV1Result

type WeatherAbroadV1Result struct {
	Result WeatherAbroadV1Response // 结果
	Body   []byte                  // 内容
	Http   gorequest.Response      // 请求
}

type WeatherV1Response

type WeatherV1Response struct {
	Status int64 `json:"status"`
	Result struct {
		Location struct {
			Country  string `json:"country"`  // 国家名称
			Province string `json:"province"` // 省份名称
			City     string `json:"city"`     // 城市名称
			Name     string `json:"name"`     // 区县名称
			Id       string `json:"id"`       // 区县id
		} `json:"location"` // 地理位置信息
		Now 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"`   // 风向描述
			Prec1h    float64 `json:"prec_1h"`    // 1小时累计降水量(mm)
			Clouds    int64   `json:"clouds"`     // 云量(%)
			Vis       int64   `json:"vis"`        // 能见度(m)
			Aqi       int64   `json:"aqi"`        // 空气质量指数数值
			Pm25      int64   `json:"pm25"`       // pm2.5浓度(μg/m3)
			Pm10      int64   `json:"pm10"`       // pm10浓度(μg/m3)
			No2       int64   `json:"no2"`        // 二氧化氮浓度(μg/m3)
			So2       int64   `json:"so2"`        // 二氧化硫浓度(μg/m3)
			O3        int64   `json:"o3"`         // 臭氧浓度(μg/m3)
			Co        float64 `json:"co"`         // 一氧化碳浓度(mg/m3)
			Uptime    string  `json:"uptime"`     // 数据更新时间,北京时间
		} `json:"now"` // 实况数据
		Alert []struct {
			Type  string `json:"type"`  // 预警事件类型
			Level string `json:"level"` // 预警事件等级
			Title string `json:"title"` // 预警标题
			Desc  string `json:"desc"`  // 预警详细提示信息
		} `json:"alert"` // 气象预警数据
		Indexes []struct {
			Name   string `json:"name"`   // 生活指数中文名称
			Brief  string `json:"brief"`  // 生活指数概要说明
			Detail string `json:"detail"` // 生活指数详细说明
		} `json:"indexes"` // 生活指数数据
		Forecasts []struct {
			Date      string `json:"date"`       // 日期,北京时区
			Week      string `json:"week"`       // 星期,北京时区
			High      int64  `json:"high"`       // 最高温度(℃)
			Low       int64  `json:"low"`        // 最低温度(℃)
			WcDay     string `json:"wc_day"`     // 白天风力
			WcNight   string `json:"wc_night"`   // 晚上风力
			WdDay     string `json:"wd_day"`     // 白天风向
			WdNight   string `json:"wd_night"`   // 晚上风向
			TextDay   string `json:"text_day"`   // 白天天气现象
			TextNight string `json:"text_night"` // 晚上天气现象
		} `json:"forecasts"` // 预报数据
		ForecastHours []struct {
			Text      string  `json:"text"`       // 天气现象
			TempFc    int64   `json:"temp_fc"`    // 温度(℃)
			WindClass string  `json:"wind_class"` // 风力等级
			WindDir   string  `json:"wind_dir"`   // 风向描述
			Rh        int64   `json:"rh"`         // 相对湿度
			Prec1h    float64 `json:"prec_1h"`    // 1小时累计降水量(mm)
			Clouds    int64   `json:"clouds"`     // 云量(%)
			DataTime  string  `json:"data_time"`  // 数据时间
		} `json:"forecast_hours"` // 未来24小时逐小时预报
	} `json:"result"`
	Message string `json:"message"`
}

type WeatherV1Result

type WeatherV1Result struct {
	Result WeatherV1Response  // 结果
	Body   []byte             // 内容
	Http   gorequest.Response // 请求
}

Jump to

Keyboard shortcuts

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