PHP code example of octopyid / indonesian-boundaries

1. Go to this page and download the library: Download octopyid/indonesian-boundaries 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/ */

    

octopyid / indonesian-boundaries example snippets




namespace App\Http\Controllers;

use Exception;
use Illuminate\Contracts\View\View;
use Illuminate\Contracts\View\Factory;
use Octopy\Indonesian\Boundaries\Boundary;
use Octopy\Indonesian\Boundaries\Draw\Draw;
use Octopy\Indonesian\Boundaries\Config\Style;
use Illuminate\Contracts\Foundation\Application;

class MapController extends Controller
{
    /**
     * @param  Boundary $boundary
     * @return Application|Factory|View
     * @throws Exception
     */
    public function index(Boundary $boundary)
    {
        $map = $boundary->element('map');

        $map->center(-0.487177, 116.317060);
        $map->draw(function (Draw $draw) {
            # Draw provincial boundaries
            $draw->province([61, 62, 63, 64, 65])->style(function (Style $style) {
                $style->color('#0F0F0F')
                    ->fillColor('#556EE6')
                    ->fillOpacity(0.2);
            });
        });

        return view('map');
    }
}