2017 © Pedro Peláez
 

yii2-extension yii2-map-input-widget

Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.

image

kolyunya/yii2-map-input-widget

Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.

  • Wednesday, January 10, 2018
  • by Kolyunya
  • Repository
  • 5 Watchers
  • 26 Stars
  • 11,113 Installations
  • JavaScript
  • 3 Dependents
  • 0 Suggesters
  • 28 Forks
  • 7 Open issues
  • 8 Versions
  • 13 % Grown

The README.md

Yii2 map input widget

Description

A Yii2 input widget which provides a user-friendly interface for selecting geographical coordinates via Google maps. Allows users to select geographical coordinates by clicking on an interative Google map embedded into you web-page. Also allows users to type in a place name to search for it via Google Places API., (*1)

The widget is composer-enabled. You can aquire the latest available version from the packagist repository., (*2)

Demo

A simple widget demo is available here. You may inspect the hidden input value via some web-developer tool (e.g. Firebug) to see how geographical coordinates are represented inside the widget., (*3)

Usage examples

Minimal example

All widget parameters are optional, have some sensible default values and may not be configured., (*4)

echo $form->field($model, 'coordinates')->widget('kolyunya\yii2\widgets\MapInputWidget');

Extended example

An exhaustive list of widget parameters (which are not derived from yii\widgets\InputWidget) available for configuration is described in the following example., (*5)

echo $form->field($model, 'coordinates')->widget(
    'kolyunya\yii2\widgets\MapInputWidget',
    [

        // Google maps browser key.
        'key' => $key,

        // Initial map center latitude. Used only when the input has no value.
        // Otherwise the input value latitude will be used as map center.
        // Defaults to 0.
        'latitude' => 42,

        // Initial map center longitude. Used only when the input has no value.
        // Otherwise the input value longitude will be used as map center.
        // Defaults to 0.
        'longitude' => 42,

        // Initial map zoom.
        // Defaults to 0.
        'zoom' => 12,

        // Map container width.
        // Defaults to '100%'.
        'width' => '420px',

        // Map container height.
        // Defaults to '300px'.
        'height' => '420px',

        // Coordinates representation pattern. Will be use to construct a value of an actual input.
        // Will also be used to parse an input value to show the initial input value on the map.
        // You can use two macro-variables: '%latitude%' and '%longitude%'.
        // Defaults to '(%latitude%,%longitude%)'.
        'pattern' => '[%longitude%-%latitude%]',

        // Google map type. See official Google maps reference for details.
        // Defaults to 'roadmap'
        'mapType' => 'satellite',

        // Marker animation behavior defines if a marker should be animated on position change.
        // Defaults to false.
        'animateMarker' => true,

        // Map alignment behavior defines if a map should be centered when a marker is repositioned.
        // Defaults to true.
        'alignMapCenter' => false,

        // A flag which defines if a search bar should be rendered over the map.
        'enableSearchBar' => true,

    ]
);

The Versions

10/01 2018

dev-master

9999999-dev https://github.com/Kolyunya/yii2-map-input-widget

Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.

  Sources   Download

GNU GPL v3.0

extension yii2 geocoding coordinates widget input map geo-coordinates

10/01 2018

v1.2.0

1.2.0.0 https://github.com/Kolyunya/yii2-map-input-widget

Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.

  Sources   Download

GNU GPL v3.0

extension yii2 geocoding coordinates widget input map geo-coordinates

10/01 2018

dev-add-support-for-jquery-v3

dev-add-support-for-jquery-v3 https://github.com/Kolyunya/yii2-map-input-widget

Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.

  Sources   Download

GNU GPL v3.0

extension yii2 geocoding coordinates widget input map geo-coordinates

12/01 2016

v1.1.0

1.1.0.0 https://github.com/Kolyunya/yii2-map-input-widget

Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.

  Sources   Download

GNU GPL v3.0

extension yii2 geocoding coordinates widget input map geo-coordinates

10/03 2015

1.0.3

1.0.3.0 https://github.com/Kolyunya/yii2-map-input-widget

Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.

  Sources   Download

GNU GPL v3.0

extension yii2 geocoding coordinates widget input map geo-coordinates

07/03 2015

1.0.2

1.0.2.0 https://github.com/Kolyunya/yii2-map-input-widget

Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.

  Sources   Download

GNU GPL v3.0

extension yii2 geocoding coordinates widget input map geo-coordinates

07/03 2015

1.0.1

1.0.1.0 https://github.com/Kolyunya/yii2-map-input-widget

Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.

  Sources   Download

GNU GPL v3.0

extension yii2 geocoding coordinates widget input map geo-coordinates

23/02 2015

1.0.0

1.0.0.0 https://github.com/Kolyunya/yii2-map-input-widget

Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.

  Sources   Download

GNU GPL v3.0

extension yii2 geocoding coordinates widget input map geo-coordinates