nicat / static-map
Generate a Yandex,Google,MapBox,Bing,CartoDB,HERE,MapQuest static map with Static Map Maker
Installs: 6 895
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 2
Open Issues: 3
Requires
- php: ~5.5|~7.0
- illuminate/support: ~5.1
Requires (Dev)
- phpunit/phpunit: 4.*
- scrutinizer/ocular: ~1.1
- squizlabs/php_codesniffer: ~2.3
This package is not auto-updated.
Last update: 2024-11-15 19:14:03 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'] ] ]) !!}
{!! StaticMap::GoogleWithImg('37.6213129,-122.3811441', ['with' => 600, 'height' => 500, 'mapType' => 'hybrid']) !!}