承接 katzz0/yii2-yandex-maps 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

katzz0/yii2-yandex-maps

Composer 安装命令:

composer require katzz0/yii2-yandex-maps

包简介

Yii 2 yandex map module

README 文档

README

This repo is the fork of the yii2-yandex-maps by Mirocow

Components

katzz0\yandexmaps\Api

Application components which register scripts.

Usage

Attach component to application (e.g. edit config/main.php):

'components' => [
	'yandexMapsApi' => [
		'class' => 'mirocow\yandexmaps\Api',
	]
 ],

katzz0\yandexmaps\Map

Map instance.

Usage

use katzz0\yandexmaps\Map;

$map = new Map('yandex_map', [
        'center' => [55.7372, 37.6066],
        'zoom' => 10,
        // Enable zoom with mouse scroll
        'behaviors' => array('default', 'scrollZoom'),
        'type' => "yandex#map",
    ],
    [
        // Permit zoom only fro 9 to 11
        'minZoom' => 9,
        'maxZoom' => 11,
        'controls' => [
          "new ymaps.control.SmallZoomControl()",
          "new ymaps.control.TypeSelector(['yandex#map', 'yandex#satellite'])",
        ],
    ]
);

katzz0\yandexmaps\Canvas

This is widget which render html tag for your map.

Usage

Simple add widget to view:

use katzz0\yandexmaps\Canvas as YandexMaps;

<?= YandexMaps::widget([
    'htmlOptions' => [
        'style' => 'height: 600px;',
    ],
    'map' => new Map('yandex_map', [
        'center' => [55.7372, 37.6066],
        'zoom' => 17,
        'controls' => [Map::CONTROL_ZOOM],
        'behaviors' => [Map::BEHAVIOR_DRAG],
        'type' => "yandex#map",
    ],
    [
        'objects' => [new Placemark(new Point(55.7372, 37.6066), [], [
            'draggable' => true,
            'preset' => 'islands#dotIcon',
            'iconColor' => '#2E9BB9',
            'events' => [
                'dragend' => 'js:function (e) {
                    console.log(e.get(\'target\').geometry.getCoordinates());
                }'
            ]
        ])]
    ])
]) ?>

You can use also direct place label:

<?= YandexMaps::widget([
    'htmlOptions' => [
        'style' => 'height: 600px;',
    ],
    'map' => new Map(null, [
        'center' => 'London',
        'zoom' => 17,
        'controls' => [Map::CONTROL_ZOOM],
        'behaviors' => [Map::BEHAVIOR_DRAG],
        'type' => "yandex#map",
    ],
    [
        'objects' => [new Placemark(null, [], [
            'draggable' => true,
            'preset' => 'islands#dotIcon',
            'iconColor' => '#2E9BB9',
            'events' => [
                'dragend' => 'js:function (e) {
                    console.log(e.get(\'target\').geometry.getCoordinates());
                    }'
            ]
        ])]
    ])
]) ?>

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 29
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-18