PHPackages                             alexantr/yii2-coordinates-input - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. alexantr/yii2-coordinates-input

AbandonedArchivedYii2-extension[Utility &amp; Helpers](/categories/utility)

alexantr/yii2-coordinates-input
===============================

Map coordinates input widget for Yii 2

1.0.0(8y ago)03303MITJavaScript

Since Feb 14Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/alexantr/yii2-coordinates-input)[ Packagist](https://packagist.org/packages/alexantr/yii2-coordinates-input)[ RSS](/packages/alexantr-yii2-coordinates-input/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Map coordinates input widget for Yii 2
======================================

[](#map-coordinates-input-widget-for-yii-2)

This extension renders an input with Google map or Yandex map and allows to set coordinates quickly by clicking on the map.

Installation
------------

[](#installation)

Install extension through [composer](http://getcomposer.org/):

```
composer require alexantr/yii2-coordinates-input

```

Configuring
-----------

[](#configuring)

At first set [Google Maps API key](https://developers.google.com/maps/documentation/javascript/get-api-key) in application config. Additionally you can set [Yandex Maps language](https://tech.yandex.ru/maps/doc/jsapi/2.1/dg/concepts/localization-docpage/)and initial coordinates for all maps.

```
[
    'components' => [
        'assetManager' => [
            'bundles' => [
                'alexantr\coordinates\CoordinatesAsset' => [
                    'googleMapsApiKey' => 'UBcsRlxWxBjmZBvrW154fXJ4eJeeO4TFMp9pRLi', //  'en_US',
                    'initialCoordinates' => [-53.106392, 73.528748], // [latitude, longitude]
                    'initialZoom' => 8, // Default is 10
                ],
            ],
        ],
    ],
]
```

Usage
-----

[](#usage)

The following code in a view file would render an input with Google map:

```
