dev-master
9999999-devFind Latitude and Longitude using google maps
MIT
The Requires
by Ibrar Turi
extension yii2 coordinates latitude longitude picker google map finder
Find Latitude and Longitude using google maps
Find Latitude and Longitude using Google Maps, (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist ibrarturi/yii2-latlng-finder "dev-master"
or add, (*4)
"ibrarturi/yii2-latlng-finder": "dev-master"
to the require section of your composer.json
file., (*5)
Once the extension is installed, simply use it in your code mentioned below. Click once on the map to the get the marker and coordinates then you can drag the marker around to the desired place on the map., (*6)
= \ibrarturi\latlngfinder\LatLngFinder::widget(); ?>
= \ibrarturi\latlngfinder\LatLngFinder::widget([ 'enableZoom' => false // true, false ]); ?>
= \ibrarturi\latlngfinder\LatLngFinder::widget([ 'latAttribute' => 'lat', // Latitude text field id 'lngAttribute' => 'lng', // Longitude text field id 'zoomAttribute' => 'zoom', // Zoom text field id 'mapCanvasId' => 'map', // Map Canvas id 'mapWidth' => 450, // Map Canvas width 'mapHeight' => 300, // Map Canvas mapHeight 'defaultLat' => -34.397, // Default latitude for the map 'defaultLng' =>150.644, // Default Longitude for the map 'defaultZoom' => 8, // Default zoom for the map 'enableZoomField' => true, // True: for assigning zoom values to the zoom field, False: Do not assign zoom value to the zoom field ]); ?>
= $form->field($model, 'lat') ?> = $form->field($model, 'lng') ?> = $form->field($model, 'zoom') ?> = \ibrarturi\latlngfinder\LatLngFinder::widget([ 'model' => $model, // model object ]); ?> ``` * Default usage with model without zoom field ```php = $form->field($model, 'lat') ?> = $form->field($model, 'lng') ?> = \ibrarturi\latlngfinder\LatLngFinder::widget([ 'model' => $model, // model object 'enableZoom' => false // true, false ]); ?> ``` * Default usage with model and optional parameters ```php = $form->field($model, 'lat') ?> = $form->field($model, 'lng') ?> = $form->field($model, 'zoom') ?> = \ibrarturi\latlngfinder\LatLngFinder::widget([ 'model' => $model, // model object 'latAttribute' => 'lat', // Latitude attribute 'lngAttribute' => 'lng', // Longitude attribute 'zoomAttribute' => 'zoom', // Zoom text attribute 'mapCanvasId' => 'map', // Map Canvas id 'mapWidth' => 450, // Map Canvas width 'mapHeight' => 300, // Map Canvas mapHeight 'defaultLat' => -34.397, // Default latitude for the map 'defaultLng' =>150.644, // Default Longitude for the map 'defaultZoom' => 8, // Default zoom for the map 'enableZoomField' => true, // True: for assigning zoom values to the zoom field, False: Do not assign zoom value to the zoom field ]); ?>
Find Latitude and Longitude using google maps
MIT
extension yii2 coordinates latitude longitude picker google map finder