1. Go to this page and download the library: Download fgh151/yii2-latlng-finder library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
<div class="form-group">
<label class="control-label" for="lat">Latitude</label>
<input class="form-control" type="text" name="lat" id="lat">
</div>
<div class="form-group">
<label class="control-label" for="lng">Longitude</label>
<input class="form-control" type="text" name="lng" id="lng">
</div>
<div class="form-group">
<label class="control-label" for="zoom">Zoom</label>
<input class="form-control" type="text" name="zoom" id="zoom">
</div>
<?= \fgh151\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, 'lat')
<?= $form->field($model, 'lat')
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.