xamap

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: BSD-3-Clause-Clear Imports: 7 Imported by: 0

Documentation

Overview

高德地图SDK

Index

Constants

View Source
const (
	COORDSYS_GPS    = "gps"    // 坐标系-GPS坐标系
	COORDSYS_MAPBAR = "mapbar" // 坐标系-图为先坐标系
	COORDSYS_BAIDU  = "baidu"  // 坐标系-百度坐标系
)

Variables

This section is empty.

Functions

func Convert

func Convert(gps []xnum.GPS, coordsys string) ([]xnum.GPS, error)

坐标地址转换

func GPS2S

func GPS2S(gps []xnum.GPS, j string) string

GPS转字符串拼接(单坐标点固定使用,拼接)

gps	坐标点列表
j	多个坐标点之间的拼接字符串

func Regedit

func Regedit(c *Config)

配置项注入

func S2GPS

func S2GPS(inf string) xnum.GPS

字符串转GPS坐标系

inf	待转换的字符串形式的坐标

func S2GPSAll

func S2GPSAll(inf string) []xnum.GPS

字符串转GPS坐标系,兼容;分割和|分割

inf	待分割转换的字符串形式的坐标

Types

type Casts

type Casts struct {
	Date           string `json:"date"`            // 日期
	Week           string `json:"week"`            // 星期几
	Dayweather     string `json:"dayweather"`      // 白天天气现象
	Nightweather   string `json:"nightweather"`    // 晚上天气现象
	Daytemp        string `json:"daytemp"`         // 白天温度
	Nighttemp      string `json:"nighttemp"`       // 晚上温度
	Daywind        string `json:"daywind"`         // 白天风向
	Nightwind      string `json:"nightwind"`       // 晚上风向
	Daypower       string `json:"daypower"`        // 白天风力
	Nightpower     string `json:"nightpower"`      // 晚上风力
	DaytempFloat   string `json:"daytemp_float"`   // 白天温度【浮点数格式】
	NighttempFloat string `json:"nighttemp_float"` // 晚上温度【浮点数格式】
}

天气预报

type Config

type Config struct {
	WebKey      string `json:"key"`      // 高德地图申请的WebKey
	WebSecurity string `json:"security"` // 高德地图申请的security密钥【可为空】
	Domain      string `json:"domain"`   // 高德地图域名前缀
}

配置项结构信息

type Forecasts

type Forecasts struct {
	City       string  `json:"city"`       // 城市名称
	Adcode     string  `json:"adcode"`     // 城市编码
	Province   string  `json:"province"`   // 省份名称
	Reporttime string  `json:"reporttime"` // 预报发布时间
	Casts      []Casts `json:"casts"`      // 预报数据list结构,元素cast,按顺序为当天、第二天、第三天的预报数据
}

省市信息

func WeatherForecast

func WeatherForecast(adcode int) ([]Forecasts, error)

获取预报天气信息

adcode	要查询的城市code

type IpInfo

type IpInfo struct {
	Province  string     `json:"province"`
	City      string     `json:"city"`
	Adcode    int        `json:"adcode"`
	Rectangle []xnum.GPS `json:"rectangle"`
}

转换成为的结构体

func Ip2info

func Ip2info(ip string) (*IpInfo, error)

IP地址转地图中的详情信息

ip	待查询的IPv4地址

type Lives

type Lives struct {
	Province         string `json:"province"`          // 省份名
	City             string `json:"city"`              // 城市名
	Adcode           string `json:"adcode"`            // 区域编码
	Weather          string `json:"weather"`           // 天气现象(汉字描述)
	Temperature      string `json:"temperature"`       // 实时气温,单位:摄氏度
	Winddirection    string `json:"winddirection"`     // 风向描述
	Windpower        string `json:"windpower"`         // 风力级别,单位:级
	Humidity         string `json:"humidity"`          // 空气湿度
	Reporttime       string `json:"reporttime"`        // 数据发布的时间
	TemperatureFloat string `json:"temperature_float"` // 实时气温,单位:摄氏度【浮点数格式】
	HumidityFloat    string `json:"humidity_float"`    // 空气湿度【浮点数格式】
}

实时天气信息

func WeatherLives

func WeatherLives(adcode int) ([]Lives, error)

获取实时天气信息

adcode	要查询的城市code

type Tips

type Tips struct {
	ID       string   `json:"id"`       // 返回数据ID
	Name     string   `json:"name"`     // tip名称
	District string   `json:"district"` // 所属区域[省+市+区(直辖市为“市+区”)]
	Adcode   int      `json:"adcode"`   // 区域编码
	Location xnum.GPS `json:"location"` // tip中心点坐标
	Address  string   `json:"address"`  // 详细地址
	Typecode int      `json:"typecode"` // 提示所属的POI类型
}

提示结构体

func Inputtips

func Inputtips(keywords string) ([]Tips, error)

输入提示

Jump to

Keyboard shortcuts

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