LeafLet MakiMarkers Plugin

What is LeafLet Marker Cluster Plugin?

Is a LeafletJs Plugin to create map icons using Maki Icons from MapBox. Markers are retrieved from MapBox's Static Marker Api.

This Plugin works in conjunction with LeafLet library for Yii 2 framework.

Installation

The preferred way to install this extension is through composer.

Either run

composer require 2amigos/yii2-leaflet-makimarker-plugin:~1.0

or add the following to the require section of your application's composer.json file:

"2amigos/yii2-leaflet-makimarker-plugin" : "~1.0"

Usage example

Using its make method:

use dosamigos\leaflet\plugins\makimarker\MakiMarker;
use dosamigos\leaflet\types\LatLng;
use dosamigos\leaflet\layers\Marker;

// LeafLet initialization component
// ...

// Initialize plugin
$makimarkers = new MakiMarker(['name' => 'makimarker']);

// install
$leafLet->installPlugin($makimarkers);

// sample location
$center = new LatLng(['lat' => 51.508, 'lng' => -0.11]);

// generate icon through its icon
$marker = new Marker([
    'latLng' => $center,
    'icon' => $leafLet->plugins->makimarker->make("rocket",['color' => "#b0b", 'size' => "m"]),
    'popupContent' => 'Hey! I am a marker'
]);

Share this

Contributors Thanks All

 

Do you have a good idea? Why Don't We Talk?