nicat/static-map

Generate a Yandex,Google,MapBox,Bing,CartoDB,HERE,MapQuest static map with Static Map Maker

v1.0.2 2017-02-16 21:25 UTC

This package is not auto-updated.

Last update: 2024-11-01 18:55:13 UTC


README

Installation

First, pull in the package through Composer.

Run composer require nicat/static-map

And then, if using Laravel 5, include the service provider within config/app.php.

'providers' => [
    Nicat\StaticMap\StaticMapServiceProvider::class,
];

And, for convenience, add a facade alias to this same file at the bottom:

'aliases' => [
    'StaticMap' => Nicat\StaticMap\Facade\StaticMap::class,
];

If you need to modify the Static Map partials, you can run:

php artisan vendor:publish

Usage

Within your controllers

StaticMap::Google('London')

You may also do:

  • StaticMap::Google('London')
  • StaticMap::Google('37.6213129,-122.3811441')
  • StaticMap::GoogleWithImg('London')
  • StaticMap::Google('London', ['with' => 600, 'height' => 500, 'mapType' => 'hybrid'])

You can modify partials

    'width'       => 600, // Width of Map image
    'height'      => 400, // Height of Map Image
    'mapType'     => 'roadmap', // Map type ['roadmap', 'terrain', 'satellite', 'hyrid']
    'imageFormat' => 'png', // gif, png or jpg
    'zoom'        => 14, // Zoom of Map

You may also can add markers:

{!! StaticMap::GoogleWithImg('London', ['markers' => ['center' => 'Westminster London', 'label' => '2'], 'imageType' => 'gif'])

If you want just add marker of main center

{!! StaticMap::GoogleWithImg('37.6213129,-122.3811441', ['markers' => true]) !!}

If you want just use with map link

{!! StaticMap::GoogleWithLink('37.6213129,-122.3811441', ['markers' => true]) !!}

Marker options

    'center'  => '37.6213129,-122.3811441', // or 'San Francisco International Airport'
    'label'   => '1', // Label Name of Marker
    'color'   => '0xff0000', //  color of marker   
    'size'    => 'mid', // tiny (Small),small (Medium), mid (Large)

##Some examples

{!! StaticMap::GoogleWithImg('San Francisco International Airport', ['markers' => [
                ['center' => 'San Bruno', 'label' => '2'],
                ['center' => '37.6213129,-122.3711441', 'label' => '1']
            ]
        ]) !!}

http://s33.postimg.org/40tfyv5a7/image.png

{!! StaticMap::GoogleWithImg('37.6213129,-122.3811441', ['with' => 600, 'height' => 500, 'mapType' => 'hybrid']) !!}

http://s33.postimg.org/5m1es88zj/image.png