heinbez/mapbox

Mapbox 静态地图生成器

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

This package is not auto-updated.

Last update: 2024-09-18 19:06:31 UTC


README

安装这个库非常简单。

使用 Composer

composer require heinbez/mapbox 

配置

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

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

使用

$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();

预览