GoogleMaps Widget displays a set of user addresses as markers on the map.
The preferred way to install this extension is through composer.
Either run
php composer.phar require yii2mod/yii2-google-maps-markers "*"
or add
"yii2mod/yii2-google-maps-markers": "*"
to the require section of your composer.json.
To use GoogleMaps, you need to configure its [[userLocations]] property. For example:
echo yii2mod\google\maps\markers\GoogleMaps::widget([
'userLocations' => [
[
'location' => [
'address' => 'Kharkiv',
'country' => 'Ukraine',
],
'htmlContent' => '<h1>Kharkiv</h1>',
],
[
'location' => [
'city' => 'New York',
'country' => 'United States',
],
'htmlContent' => '<h1>New York</h1>',
],
],
]);
To configure the Google Maps key or other options like language, version, library, or map options:
echo yii2mod\google\maps\markers\GoogleMaps::widget([
'userLocations' => [...],
'googleMapsUrlOptions' => [
'key' => 'this_is_my_key',
'language' => 'id',
'version' => '3.1.18',
],
'googleMapsOptions' => [
'mapTypeId' => 'roadmap',
'tilt' => 45,
'zoom' => 5,
],
]);
OR via yii params configuration. For example:
'params' => [
'googleMapsUrlOptions' => [
'key' => 'this_is_my_key',
'language' => 'id',
'version' => '3.1.18',
],
'googleMapsOptions' => [
'mapTypeId' => 'roadmap',
'tilt' => 45,
'zoom' => 10,
],
],
To get key, please visit page
You can find them on the options page