Yii Yandex Maps extension
PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
YandexMap.php

README.md

Yandex Maps

Yii Yandex Maps addition to allowing sozlavat map with labels and lines.

Installation and Setup

Place the extension files in a directory 'extensions' of your application. For example, in a folder yandexmap

'ext.yandexmap.YandexMap'

Use

	$this->widget('ext.yandexmap.YandexMap',array(
		'id'=>'map',
		'width'=>600,
		'height'=>400,
		'center'=>array(55.76, 37.64),
		'controls' => array(
			'zoomControl' => true,
			'typeSelector' => true,
			'mapTools' => true,
			'smallZoomControl' => false,
			'miniMap' => true,
			'scaleLine' => true,
			'searchControl' => true,
			'trafficControl' => true
		),
		'placemark' => array(
			array(
				'lat'=>55.8,
				'lon'=>37.8,
				'properties'=>array(
					'balloonContentHeader'=>'header',
					'balloonContent'=>'1',
					'balloonContentFooter'=>'footer',
				),
				'options'=>array(
					'draggable'=>true
				)
			)
		),
		'polyline' => array(
			array('lat'=>55.80,'lon'=>37.30),
			array('lat'=>55.80,'lon'=>37.40),
            array('lat'=>55.70,'lon'=>37.30),
            array('lat'=>55.70,'lon'=>37.40),
			'properties'=>array(
				'balloonContentHeader'=>'header',
				'balloonContent'=>'Ломаная линия',
				'balloonContentFooter'=>'footer',
			),
			'options'=>array(
				'draggable'=>true,
				'strokeColor'=> '#000000',
				'strokeWidth'=> 4,
				'strokeStyle'=> '1 5'
			)
		),
	));

Use Placemark

Placemark (labels) - can be passed as a single item or a group of elements.

	'placemark' => array(
		'lat'=>55.8,
		'lon'=>37.8,
		'properties'=>array(
			'balloonContentHeader'=>'header',
			'balloonContent'=>'1',
			'balloonContentFooter'=>'footer',
		),
		'options'=>array(
			'draggable'=>true
		)
	),

group

	'placemark' => array(
		array(
			'lat'=>55.8,
			'lon'=>37.8,
			'properties'=>array(
				'balloonContentHeader'=>'header',
				'balloonContent'=>'placemark_1',
				'balloonContentFooter'=>'footer',
			),
			'options'=>array(
				'draggable'=>true
			)
		),
		array(
			'lat'=>55.8,
			'lon'=>37.8,
			'properties'=>array(
				'balloonContentHeader'=>'header',
				'balloonContent'=>'placemark_2',
				'balloonContentFooter'=>'footer',
			),
			'options'=>array(
				'draggable'=>true
			)
		),
	),

Use Polyline

Polyline (broken lines) - you can peredevat as one item or as Grumm elements. Tocher coordinates given arrays, and can be infinite.

	'polyline' => array(
		array('lat'=>55.80,'lon'=>37.30),
		array('lat'=>55.80,'lon'=>37.40),
		array('lat'=>55.70,'lon'=>37.30),
		array('lat'=>55.70,'lon'=>37.40),
		'properties'=>array(
			'balloonContentHeader'=>'header',
			'balloonContent'=>'Ломаная линия',
			'balloonContentFooter'=>'footer',
		),
		'options'=>array(
			'draggable'=>true,
			'strokeColor'=> '#000000',
			'strokeWidth'=> 4,
			'strokeStyle'=> '1 5'
		)
	),

group

// ...
	'polyline' => array(
		array(
			array('lat'=>55.80,'lon'=>37.30),
			array('lat'=>55.80,'lon'=>37.40),
			array('lat'=>55.70,'lon'=>37.30),
			array('lat'=>55.70,'lon'=>37.40),
			'properties'=>array(
				'balloonContentHeader'=>'header',
				'balloonContent'=>'Ломаная линия 1',
				'balloonContentFooter'=>'footer',
			),
			'options'=>array(
				'draggable'=>true,
				'strokeColor'=> '#000000',
				'strokeWidth'=> 4,
				'strokeStyle'=> '1 5'
			)
		),
		array(
			array('lat'=>55.80,'lon'=>37.30),
			array('lat'=>55.80,'lon'=>37.40),
			array('lat'=>55.70,'lon'=>37.30),
			array('lat'=>55.70,'lon'=>37.40),
			'properties'=>array(
				'balloonContentHeader'=>'header',
				'balloonContent'=>'Ломаная линия 2',
				'balloonContentFooter'=>'footer',
			),
			'options'=>array(
				'draggable'=>true,
				'strokeColor'=> '#000000',
				'strokeWidth'=> 4,
				'strokeStyle'=> '1 5'
			)
		),
	),
// ...