0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby interface to the Mapbox API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
>= 0

Runtime

~> 0.45.3
~> 0.2.0
 Project Readme

Build Status Code Climate Coverage Status

A Ruby interface to the Mapbox API.

This gem is under development, use with precautions

Installation

gem install mapbox-ruby

or in Bundler:

gem 'mapbox-ruby'    

In order to use this gem you need a valid access_token from Mapbox and how Mapbox works.

Usage

Html

html = Mapbox::Html.new(access_token: 'xxxxxxxxxxx', mapid: Mapbox::ID_STREETS)
html.get # return a valid html page with the map

Image

img = Mapbox::Image.new(access_token: 'xxxxxxxxxxx', mapid: Mapbox::ID_STREETS, 
						lat: 42, lon: 8, zoom: 5, width: 500, height: 300)
img.get # return a ruby Tempfile

With Mapbox::Image you can use Overlays (GeoJSON not supported yet from mapbox-ruby)

img.overlays << Mapbox::Overlay::Marker.add(
      lat: 42,
      lon: 8,
      size: 'm',
      label: 'beer',
      color: '0000FF'
  )

img.overlays << Mapbox::Overlay::Path.add(
      size: '5',
      polyline: 'xxxxxx' 
  )

Read more about Polyline

Geocoding

# Forward geocode
mg = Mapbox::Geocode.new(access_token: 'xxxxxxxxxxx', query: '1 ocean drive miami beach' )
mg.get # return ruby Hash with mapbox body response

# Reverse geocode	
mg = Mapbox::Geocode.new(access_token: 'xxxxxxxxxxx',
							lat: '25.768924',
							lon: '-80.13245')
mg.get # return ruby Hash with mapbox body response