2017 © Pedro Peláez
 

yii2-extension yii2-leaflet-geocoder-plugin

Yii2 LeafLet Plugin to provide support for address lookup with dropdown list of results to Leaflet.

image

2amigos/yii2-leaflet-geocoder-plugin

Yii2 LeafLet Plugin to provide support for address lookup with dropdown list of results to Leaflet.

  • Tuesday, February 9, 2016
  • by tonydspaniard
  • Repository
  • 12 Watchers
  • 1 Stars
  • 2,749 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 2 Open issues
  • 6 Versions
  • 7 % Grown

The README.md

Geo Search Plugin

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads, (*1)

Yii 2 LeafletJs Plugin that adds support for address lookup to Leaflet with dropdown list capabilities and loading icon feedback. This Plugin works in conjunction with LeafLet library for Yii 2 framework., (*2)

Important The libraries used on this plugin have been modified from the original plugin source. So, if you wish to modify the plugin, remember that you cannot update it from its original source., (*3)

Installation

The preferred way to install this extension is through composer., (*4)

Either run, (*5)

composer require 2amigos/yii2-leaflet-geocoder-plugin:~1.0

or add, (*6)

"2amigos/yii2-leaflet-geocoder-plugin" : "~1.0"

to the require section of your application's composer.json file., (*7)

Usage

There are four services that you can use, even though we have implemented only three:, (*8)

  • Nominatim
  • Bing
  • MapQuest

Anybody will to help integrate more services, is very welcome :), (*9)

use dosamigos\leaflet\layers\TileLayer;
use dosamigos\leaflet\LeafLet;
use dosamigos\leaflet\types\LatLng;
use dosamigos\leaflet\layers\Marker;
use dosamigos\leaflet\plugins\geocoder\ServiceNominatim;
use dosamigos\leaflet\plugins\geocoder\GeoCoder;


// lets use nominating service
$nominatim = new ServiceNominatim();

// create geocoder plugin and attach the service
$geoCoderPlugin = new GeoCoder([
    'service' => $nominatim,
    'clientOptions' => [
        // we could leave it to allocate a marker automatically
        // but I want to have some fun
        'showMarker' => false
    ]
]);

// add a marker to center
$center = new LatLng(['lat' => '49.006889', 'lng' => '8.403653']);
$marker = new Marker([
    'name' => 'geoMarker',
    'latLng' => $center,
    'clientOptions' => ['draggable' => true], // draggable marker
    'clientEvents' => [
        'dragend' => 'function(e){
            console.log(e.target._latlng.lat, e.target._latlng.lng);
        }'
    ]
]);

// configure the tile layer
$tileLayer = new TileLayer([
    'urlTemplate' => 'http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg',
    'clientOptions' => [
        'attribution' => 'Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> ' .
            '<img src="http://developer.mapquest.com/content/osm/mq_logo.png">, ' .
            'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' .
            '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
        'subdomains' => '1234'
    ]
]);

// initialize our leafLet component
$leafLet = new LeafLet([
    'name' => 'geoMap',
    'tileLayer' => $tileLayer,
    'center' => $center,
    'zoom' => 10,
    'clientEvents' => [
        // I added an event to ease the collection of new position
        'geocoder_showresult' => 'function(e){
            // set markers position
            geoMarker.setLatLng(e.Result.center);
        }'
    ]
]);

// add the marker
$leafLet->addLayer($marker);

// install the plugin
$leafLet->installPlugin($geoCoderPlugin);

// run the widget (you can also use dosamigos\leaflet\widgets\Map::widget([...]))
echo $leafLet->widget();

Testing

$ ./vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details., (*10)

Credits

License

The BSD License (BSD). Please see License File for more information., (*11)

2amigOS!
Web development has never been so fun!
www.2amigos.us, (*12)

The Versions

09/02 2016

dev-master

9999999-dev http://yiiwheels.com/extension/leaflet-geocoder-plugin

Yii2 LeafLet Plugin to provide support for address lookup with dropdown list of results to Leaflet.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

plugin extension yii2 2amigos yii maps yii 2 widget leaflet

09/02 2016

1.0.2

1.0.2.0 http://yiiwheels.com/extension/leaflet-geocoder-plugin

Yii2 LeafLet Plugin to provide support for address lookup with dropdown list of results to Leaflet.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

plugin extension yii2 2amigos yii maps yii 2 widget leaflet

08/02 2016

1.0.1

1.0.1.0 http://yiiwheels.com/extension/leaflet-geocoder-plugin

Yii2 LeafLet Plugin to provide support for address lookup with dropdown list of results to Leaflet.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

plugin extension yii2 2amigos yii maps yii 2 widget leaflet

07/04 2015

1.0.0

1.0.0.0 http://yiiwheels.com/extension/leaflet-geocoder-plugin

Yii2 LeafLet Plugin to provide support for address lookup with dropdown list of results to Leaflet.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

plugin extension yii2 2amigos yii maps yii 2 widget leaflet

24/04 2014

0.1.1

0.1.1.0

Yii2 LeafLet Plugin to provide support for address lookup with dropdown list of results to Leaflet.

  Sources   Download

BSD-3-Clause

The Requires

 

plugin extension yii maps widget leaflet

23/04 2014

0.1.0

0.1.0.0

Yii2 LeafLet Plugin to provide support for address lookup with dropdown list of results to Leaflet.

  Sources   Download

BSD-3-Clause

The Requires

 

plugin extension yii maps widget leaflet