LaravelPackages.net
Acme Inc.
Toggle sidebar
nicat/static-map

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

6.906
8
v1.0.2
About nicat/static-map

nicat/static-map is a Laravel package for generate a yandex,google,mapbox,bing,cartodb,here,mapquest static map with static map maker. It currently has 8 GitHub stars and 6.906 downloads on Packagist (latest version v1.0.2). Install it with composer require nicat/static-map. Discover more Laravel packages by nicat or browse all Laravel packages to compare alternatives.

Last updated

Laravel Static Map Generator

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

Comments