mapbox

package
v0.10.13 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CountryAbroad 国外
	CountryAbroad = "" /* 749-byte string literal not displayed */

	// CountryChina 国内
	CountryChina = "cn"

	// CountryGlobal 全球
	CountryGlobal = CountryAbroad + "," + CountryChina

	// LanguageChinese 中文
	LanguageChinese = "zh"
)

Variables

This section is empty.

Functions

func WithCountry

func WithCountry(country CountryStr) func(*Geocoding)

func WithLanguage

func WithLanguage(language string) func(*Geocoding)

func WithQuery

func WithQuery(q string) func(*Geocoding)

Types

type Context added in v0.9.2

type Context struct {
	ID         string `json:"id,omitempty"`
	MapboxID   string `json:"mapbox_id,omitempty"`
	TextZh     string `json:"text_zh,omitempty"`
	Text       string `json:"text,omitempty"`
	Wikidata   string `json:"wikidata,omitempty"`
	ShortCode  string `json:"short_code,omitempty"`
	LanguageZh string `json:"language_zh,omitempty"`
	Language   string `json:"language,omitempty"`
}

type CountryStr

type CountryStr string // 国家代码

type Feature added in v0.9.2

type Feature struct {
	ID                string     `json:"id,omitempty"`
	Type              string     `json:"type,omitempty"`
	PlaceType         []string   `json:"place_type,omitempty"`
	Relevance         float64    `json:"relevance,omitempty"`
	Properties        Properties `json:"properties,omitempty"`
	TextZh            string     `json:"text_zh,omitempty"`
	LanguageZh        string     `json:"language_zh,omitempty"`
	PlaceNameZh       string     `json:"place_name_zh,omitempty"`
	Text              string     `json:"text,omitempty"`
	Language          string     `json:"language,omitempty"`
	PlaceName         string     `json:"place_name,omitempty"`
	MatchingText      string     `json:"matching_text,omitempty"`
	MatchingPlaceName string     `json:"matching_place_name,omitempty"`
	Center            [2]float64 `json:"center,omitempty"`
	Geometry          Geometry   `json:"geometry,omitempty"`
	Context           []Context  `json:"context,omitempty"`
}

type Geocoding

type Geocoding struct {
	Mapbox

	Country  CountryStr
	Language string

	Q string
}

func NewGeocoding

func NewGeocoding(accessToken string, options ...func(*Geocoding)) *Geocoding

func (*Geocoding) Query

func (g *Geocoding) Query() ([]byte, error)

type GeocodingRes added in v0.9.2

type GeocodingRes struct {
	Type        string    `json:"type,omitempty"`
	Query       []string  `json:"query,omitempty"`
	Features    []Feature `json:"features,omitempty"`
	Attribution string    `json:"attribution,omitempty"`
}

type Geometry added in v0.9.2

type Geometry struct {
	Coordinates [2]float64 `json:"coordinates,omitempty"`
	Type        string     `json:"type,omitempty"`
}

type LanguageStr

type LanguageStr string // 语言代码

type Mapbox

type Mapbox struct {
	AccessToken string
}

type Properties added in v0.9.2

type Properties struct {
	Foursquare string `json:"foursquare,omitempty"`
	Wikidata   string `json:"wikidata,omitempty"`
	Landmark   bool   `json:"landmark,omitempty"`
	Address    string `json:"address,omitempty"`
	Category   string `json:"category,omitempty"`
}

Jump to

Keyboard shortcuts

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