项目作者: mihaylichenko

项目描述 :
Yii2 map widget allows you to simplify the entry of geographic coordinates for your form. Support google and yandex maps services.
高级语言: PHP
项目地址: git://github.com/mihaylichenko/yii2-widget-mappicker.git
创建时间: 2016-02-21T10:22:52Z
项目社区:https://github.com/mihaylichenko/yii2-widget-mappicker

开源协议:

下载


Map input widget for Yii2

The widget allows you to simplify the entry of geographic coordinates for your form. Support google and yandex maps services.

Installation

The preferred way to install this extension is through composer.

  1. $ php composer.phar require msvdev/yii2-widget-mappicker "*"

or add

  1. "msvdev/yii2-widget-mappicker": "*"

to the require section of your composer.json file.

Usage

Minimal example for google maps

  1. echo $form->field($model, 'coordinatesAttribute')->widget(\msvdev\widgets\mappicker\MapInput::className(), ['apiKey' => 'google_api_key']);

Minimal example for yandex maps

  1. echo $form->field($model, 'coordinatesAttribute')->widget(\msvdev\widgets\mappicker\MapInput::className(), ['service' => 'yandex']);

Example settings

  1. use \msvdev\widgets\mappicker\MapInput;
  2. echo $form->field($model, 'coordinatesAttribute')->widget(
  3. MapInput::className(),
  4. [
  5. 'language' => 'en-Us', // map language, default is the same as in the app
  6. 'service' => 'google', // map service provider, "google" or "yandex", default "google"
  7. 'apiKey' => '', // required google maps
  8. 'coordinatesDelimiter' => '@', // attribute coordinate string delimiter, default "@" (lat@lng)
  9. 'mapWidth' => '800px', // width map container, default "500px"
  10. 'mapHeight' => '500px', // height map container, default "500px"
  11. 'mapZoom' => '14', // map zoom value, default "10"
  12. 'mapCenter' => [55.753338, 37.622861], // coordinates center map with an empty attribute, default Moscow
  13. ]
  14. );