mapbox

package module
v0.0.0-...-3cde84e Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2014 License: MIT Imports: 9 Imported by: 0

README

Mapbox Google Go Client

This is a very first draft of a Google Go client for Mapbox.

License

This code comes with a MIT license.

Documentation

Overview

Mapbox is a Go package for interacting with the Mapbox API.

Index

Constants

View Source
const (
	MapboxHost       = "api.tiles.mapbox.com"
	MapboxPathPrefix = "/v4"
	UserAgent        = "Mapbox Google Go Client v0.1"
)

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(accessToken string) *Client

func (*Client) BaseURL

func (c *Client) BaseURL() string

func (*Client) Geocoding

func (c *Client) Geocoding() *GeocodingAPI

func (*Client) HTTPClient

func (c *Client) HTTPClient() *http.Client

func (*Client) HTTPS

func (c *Client) HTTPS() bool

func (*Client) Images

func (c *Client) Images(mapId string) *ImagesAPI

func (*Client) SetHTTPClient

func (c *Client) SetHTTPClient(client *http.Client)

func (*Client) SetHTTPS

func (c *Client) SetHTTPS(https bool)

type GeocodingAPI

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

func (*GeocodingAPI) QueryByAddress

func (api *GeocodingAPI) QueryByAddress(address *QueryByAddressRequest) (*QueryByAddressResponse, error)

QueryByAddress performs a forward geo-encoding. It takes an address and returns all kinds of information about it, e.g. the latitude and longitude. There might be more than one such result. See QueryByAddressResponse for details.

type ImageRequest

type ImageRequest struct {
	Latitude  float64
	Longitude float64
	Zoom      int
	Width     int
	Height    int
	Format    string
	Retina    bool
	Markers   []*Marker
}

type ImageResponse

type ImageResponse struct {
}

type ImagesAPI

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

func (*ImagesAPI) Get

func (api *ImagesAPI) Get(req *ImageRequest) (image.Image, error)

type Marker

type Marker struct {
	Name      string
	Label     string
	Color     string
	Latitude  float64
	Longitude float64
}

func NewMarker

func NewMarker() *Marker

func (*Marker) String

func (m *Marker) String() string

type QueryByAddressRequest

type QueryByAddressRequest struct {
	// Index is the geocoding index as specified on
	// https://www.mapbox.com/developers/api/geocoding/.
	// If you construct a QueryByAddressRequest via
	// NewQueryByAddressRequest, the the Index is set to
	// "mapbox.places-v1" by default.
	Index string

	// Query is the address you want to decode.
	Query string
}

func NewQueryByAddressRequest

func NewQueryByAddressRequest() *QueryByAddressRequest

NewQueryByAddressRequest creates a new QueryByAddressRequest. It initializes the geocoding index with "mapbox.places-v1".

type QueryByAddressResponse

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

QueryByAddressResponse is the result of a call to QueryByAddress.

type QueryByAddressResponseFeature

type QueryByAddressResponseFeature struct {
	Type        string                 `json:"type,omitempty"`
	Text        string                 `json:"text,omitempty"`
	Relevance   float64                `json:"relevance,omitempty"`
	PlaceName   string                 `json:"place_name,omitempty"`
	Properties  map[string]interface{} `json:"properties,omitempty"`
	ID          string                 `json:"id,omitempty"`
	Geometry    *json.RawMessage       `json:"geometry,omitempty"`
	Context     *json.RawMessage       `json:"context,omitempty"`
	Center      []float64              `json:"center,omitempty"`
	BoundingBox []float64              `json:"bbox,omitempty"`
}

Jump to

Keyboard shortcuts

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