2017 © Pedro Peláez
 

yii2-extension yii2-leaflet-markercluster-plugin

Yii2 LeafLet Plugin to provide beautiful, sophisticated, high performance marker clustering solution with smooth animations and lots of great features.

image

2amigos/yii2-leaflet-markercluster-plugin

Yii2 LeafLet Plugin to provide beautiful, sophisticated, high performance marker clustering solution with smooth animations and lots of great features.

  • Thursday, April 2, 2015
  • by tonydspaniard
  • Repository
  • 12 Watchers
  • 2 Stars
  • 3,595 Installations
  • JavaScript
  • 1 Dependents
  • 0 Suggesters
  • 5 Forks
  • 3 Open issues
  • 3 Versions
  • 2 % Grown

The README.md

Marker Cluster Plugin

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads, (*1)

Yii 2 LeafletJs Plugin to provide beautiful, sophisticated, high performance marker clustering solution with smooth animations and lots of great features. This Plugin works in conjunction with LeafLet library for Yii 2 framework., (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

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

or add, (*5)

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

to the require section of your application's composer.json file., (*6)

Usage

Using an external json url source:, (*7)

// LeafLet initialization component
// ...

// create cluster plugin
$cluster = new dosamigos\leaflet\plugins\markercluster\MarkerCluster([
     'jsonUrl' =>  Yii::$app->controller->createUrl('site/json')
]);

// install to LeafLet component
$leafLet->plugins->install($cluster);

// done render widget
echo $leafLet->widget(['options' => ['style' => 'height: 400px']]);

The example action returning the markers:, (*8)

public function actionJson()
{
    Yii::$app->getResponse()->format = Response::FORMAT_JSON;
    echo json_encode([
        "markers" =>  [
            ["lat"=>-37.8210922667, "lng"=>175.2209316333, "popup" => "2"],
            ["lat"=>-37.8210819833, "lng"=>175.2213903167, "popup" => "3"],

        ]
    ]);
}

Now, adding markers as we create them:, (*9)

// LeafLet initialization component
// ...

// create cluster plugin
$cluster = new dosamigos\leaflet\plugins\markercluster\MarkerCluster([
     'jsonUrl' =>  Yii::$app->controller->createUrl('site/json')
]);

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

$marker1 = new dosamigos\leaflet\layers\Marker([
    'latLng' => $center,
    'popupContent' => 'Hey! I am a marker'
]);

$marker2 = new dosamigos\leaflet\layers\Marker([
     'latLng' => $center,
     'popupContent' => 'Hey! I am a second marker'
]);

// add them to the cluster plugin
$cluster
    ->addLayer($marker1)
    ->addLayer($marker2);

// install to LeafLet component
$leafLet->plugins->install($cluster);


Contributing

Please see CONTRIBUTING for details., (*10)

Credits

License

The BSD License (BSD). Please see License File for more information., (*11)

2amigOS!
Web development has never been so fun!
www.2amigos.us, (*12)

The Versions

02/04 2015

dev-master

9999999-dev http://yiiwheels.com/extension/leaflet-markercluster-plugin

Yii2 LeafLet Plugin to provide beautiful, sophisticated, high performance marker clustering solution with smooth animations and lots of great features.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

plugin extension yii2 2amigos yii maps yii 2 widget leaflet

31/03 2015

1.0.0

1.0.0.0

Yii2 LeafLet Plugin to provide beautiful, sophisticated, high performance marker clustering solution with smooth animations and lots of great features.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

plugin extension yii2 2amigos yii maps yii 2 widget leaflet

17/02 2014

0.1.0

0.1.0.0

Yii2 LeafLet Plugin to provide beautiful, sophisticated, high performance marker clustering solution with smooth animations and lots of great features.

  Sources   Download

BSD-3-Clause

The Requires

 

plugin extension yii maps widget leaflet