go-mapbox

module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2017 License: MIT

README

go-mapbox

Mapbox API wrappers for Golang

Documentation GitHub tag Build Status

See here for other golang/mapbox projects.

Status

Very early WIP, pull requests and issues are most welcome. See lib/geocode/ or lib/directions/ for an example module to mimic.

Modules
  • Geocoding
  • Directions
  • Styles
  • Maps
  • Static
  • Datasets

Examples

Initialisation
// Import the core module (and any required APIs)
import (
    "gopkg.in/ryankurte/go-mapbox.v0/lib"
    "gopkg.in/ryankurte/go-mapbox.v0/lib/base"
)

// Fetch token from somewhere
token := os.Getenv("MAPBOX_TOKEN")

// Create new mapbox instance
mapBox := mapbox.NewMapbox(token)

Map API
import (
    "gopkg.in/ryankurte/go-mapbox.v0/lib/maps"
)

img, err := mapBox.Maps.GetTiles(maps.MapIDSatellite, 1, 0, 0, maps.MapFormatJpg90, true)
Geocoding
import (
    "gopkg.in/ryankurte/go-mapbox.v0/lib/geocode"
)

// Forward Geocoding
var forwardOpts geocode.ForwardRequestOpts
forwardOpts.Limit = 1

place := "2 lincoln memorial circle nw"

forward, err := mapBox.Geocode.Forward(place, &forwardOpts)


// Reverse Geocoding
var reverseOpts geocode.ReverseRequestOpts
reverseOpts.Limit = 1

loc := &base.Location{72.438939, 34.074122}

reverse, err := mapBox.Geocode.Reverse(loc, &reverseOpts)

Directions
import (
    "gopkg.in/ryankurte/go-mapbox.v0/lib/directions"
)

var directionOpts directions.RequestOpts

locs := []base.Location{{-122.42, 37.78}, {-77.03, 38.91}}

directions, err := mapBox.Directions.GetDirections(locs, directions.RoutingCycling, &directionOpts)

Layout


If you have any questions, comments, or suggestions, feel free to open an issue or a pull request.

Directories

Path Synopsis
lib

Jump to

Keyboard shortcuts

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