Yii 1.1: yandexmap

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

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),
        'placemark' => array(
            array(
                'lat'=>55.8,
                'lon'=>37.8,
                'options'=>array(
                    'balloonContentHeader'=>'header',
                    'balloonContentBody'=>'body',
                    'balloonContentFooter'=>'footer',
                )
            )
        ),
        '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),
            'options'=>array(
                'strokeWidth'=> 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,
                'options'=>array(
                    'balloonContentHeader'=>'header',
                    'balloonContentBody'=>'body',
                    'balloonContentFooter'=>'footer',
                )
 
        ),
...

group

...
        'placemark' => array(
            array(
                'lat'=>55.8,
                'lon'=>37.8,
                'options'=>array(
                    'balloonContentHeader'=>'header',
                    'balloonContentBody'=>'body',
                    'balloonContentFooter'=>'footer',
                )
            ),
            array(
                'lat'=>55.8,
                'lon'=>37.8,
                'options'=>array(
                    'balloonContentHeader'=>'header',
                    'balloonContentBody'=>'body',
                    'balloonContentFooter'=>'footer',
                )
            ),
        ),
...

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),
        'options'=>array(
            'strokeWidth'=> 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),
            'options'=>array(
                'strokeWidth'=> 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),
            'options'=>array(
                'strokeWidth'=> 5 // ширина линии
            )
        ),
    ),
...

Resources

github.com

Total 4 comments

#11276 report it
enchikiben at 2013/01/03 12:20am
error looks like fine missing...

API components can be loaded via HTTP, and for HTTPS. If the site supports for both protocols, you can omit the explicit scheme in the src attribute of the element script. I corrected this flaw to indicate full reference (default http), please download the latest version from github.com

#11267 report it
khaperey at 2013/01/02 01:56pm
error looks like fine missing...

sorry just change the / to \ in this line and no error so far but also nothing show up on screen.

$cs->registerScriptFile("\\api-maps.yandex.ru\2.0-stable\?".  implode("&", $url) );

Still trying to resolve it if there is some thing Im doing wrong.

#11265 report it
enchikiben at 2013/01/02 10:51am
error looks like fine missing...

Khaperey At 2013/01/02 10: 21am

which line / situation is this error? in addition are not using the file_get_contents

#11263 report it
khaperey at 2013/01/02 10:21am
error looks like fine missing...

file_get_contents(C:\wamp\www\demo\/api-maps.yandex.ru/2.0-stable/?load=package.full&lang=ru-RU) [function.file-get-contents]: failed to open stream: No such file or directory

Leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet