edofre/yii2-marker-clusterer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

edofre/yii2-marker-clusterer

Composer 安装命令:

composer require edofre/yii2-marker-clusterer

包简介

Yii2 assets and marker clusterer

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

Installation

The preferred way to install this extension is through composer.

To install, either run

$ php composer.phar require edofre/yii2-marker-clusterer

or add

"edofre/yii2-marker-clusterer": "v1.0.1"

to the require section of your composer.json file.

Usage

MarkerClusterer extension to be used in co-operation with 2amigos/yii2-google-maps-library

Below you will find a full example of a view file that uses the clusterer

<?php

/* @var $this yii\web\View */

use dosamigos\google\maps\LatLng;
use dosamigos\google\maps\overlays\InfoWindow;

// edofre objects instead of dosamigos
use edofre\markerclusterer\Map;
use edofre\markerclusterer\Marker;

$this->title = 'Maps Clusterer';
?>
<div class="maps-index">
	<?php
	$map = new Map([
		'center' => new LatLng(['lat' => 52.1326, 'lng' => 5.2913]), // Center of Netherlands
		'zoom'   => 7,
	]);

	$cities = [
		'Utrecht'    => new LatLng(['lat' => 52.0841659, 'lng' => 5.0124518]),
		'Groningen'  => new LatLng(['lat' => 53.2216845, 'lng' => 6.4947123]),
		'Amsterdam'  => new LatLng(['lat' => 52.3745291, 'lng' => 4.7585311]),
		'Amstelveen' => new LatLng(['lat' => 52.2861961, 'lng' => 4.7820703]),
		'Hilversum'  => new LatLng(['lat' => 52.2315507, 'lng' => 5.0905084]),
		'Ede'        => new LatLng(['lat' => 52.052436, 'lng' => 5.6301072]),
		'Amersfoort' => new LatLng(['lat' => 52.1589302, 'lng' => 5.3077834]),
		'Zwolle'     => new LatLng(['lat' => 52.514148, 'lng' => 5.9669147]),
		'Leiden'     => new LatLng(['lat' => 52.1517316, 'lng' => 4.4466504]),
		'Rotterdam'  => new LatLng(['lat' => 51.9279514, 'lng' => 4.4203666]),
		'The Hague'  => new LatLng(['lat' => 52.0716334, 'lng' => 4.2398287]),
		'Delft'      => new LatLng(['lat' => 51.9995297, 'lng' => 4.3286785]),
		'Eindhoven'  => new LatLng(['lat' => 51.4455368, 'lng' => 5.3814706]),
	];

	foreach ($cities as $city => $lat_lng) {
		$marker = new Marker([
			'position'  => $lat_lng,
			'title'     => $city,
			'clickable' => true,
		]);

		$marker->attachInfoWindow(new InfoWindow(['content' => "<strong>{$city}</strong>"]));
		$map->addOverlay($marker);
	}

	$map->center = $map->getMarkersCenterCoordinates();
	$map->zoom = $map->getMarkersFittingZoom() - 1;
	?>

	<div class="row">
		<div class="col-sm-12">
			<?= $map->display(); ?>
		</div>
	</div>
</div>

Make sure to add the google maps key to your assetManager

'assetManager' => [
	'bundles' => [
		'dosamigos\google\maps\MapAsset' => [
			'options' => [
				'key'      => 'XYZ',
				'language' => 'nl',
				'version'  => '3.1.18',
			],
		],
	],
],

统计信息

  • 总下载量: 34.23k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 1
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-06-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固