PHP code example of binbin8730 / amap-latlong

1. Go to this page and download the library: Download binbin8730/amap-latlong 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/ */

    

binbin8730 / amap-latlong example snippets



    'extensions' => [

        'amap-latlong' => [

            // Whether to enable this extension, defaults to true
            'enable' => true,

            // Specify the default provider
            'default' => 'amap',

            // According to the selected provider above, fill in the corresponding api_key
            'providers' => [
                'amap' => [
                    'api_key' => '',
                    'api_secret' => ''
                ],
            ],
        ]
    ]


$form->amap_latlong('latitude', 'longitude', 'Position');

// Set the map height
$form->amap_latlong('latitude', 'longitude', 'Position')->height(500);

// Set the map zoom
$form->amap_latlong('latitude', 'longitude', 'Position')->zoom(16);

// Set default position
$form->amap_latlong('latitude', 'longitude', 'Position')->default(['lat' => 90, 'lng' => 90]);

$show->field('Position')->amap_latlong('lat_column', 'long_column', $height = 400, $zoom = 16);