PHP code example of wyrihaximus / staticmap

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

    

wyrihaximus / staticmap example snippets




use Imagine\Gd\Imagine;
use Imagine\Image\Box;
use WyriHaximus\StaticMap;

r = new StaticMap\Renderer(
    new Imagine(),
    $zoom,
    new Box($width, $height),
    new StaticMap\LatLng($latitude, $longitude),
    new StaticMap\Tiles('http://example.com/tiles/' . $zoom . '/{x}/{y}.png')
);

header('Content-Type: image/png');
echo $renderer->generate()->get('png', array(
    'quality' => 9,
));


use WyriHaximus\StaticMap\Blip;
use WyriHaximus\StaticMap\LatLng;

$renderer->addBlip(Blip::create(new LatLng(123, 456), 'http://static.wyrimaps.net/icons/blip.png'));



$renderer->addCenterBlip();