heinbez/mapbox

Mapbox Static Map Generator

dev-master 2015-12-09 18:14 UTC

This package is not auto-updated.

Last update: 2024-06-26 17:55:29 UTC


README

Installation

Installing the library is super easy.

Using Composer

composer require heinbez/mapbox 

Configuration

include '../vendor/autoload.php';

Mapbox\Mapbox::setConfig(
    new Mapbox\MapboxConfiguration([
        'host' => 'https://api.mapbox.com/v4',
        'style' => 'mapbox.light',
        'client' => [
            'key' => 'xxx',
            'secret' => 'xxx'
        ]
    ])
);

Using

$mapbox = new Mapbox\Mapbox($width, $height);

// Configure your path style
$mapbox->setStyle(
    new Mapbox\MapboxStyle([
        'stroke-width' => 6,
        'stroke' => '#6b5fe9',
        'stroke-opacity' => 1
    ])
);

// Push Coordinates
$mapbox->pushCoordinates(
    new MapboxCollection(array(
        [144.96300, -37,80650],
        [144.96500, -37,80680],
        etc..
    ));
);

// Return the map URL
echo $mapbox->generate();

Preview