public function getMarker(Record $model, $key, $index) { $marker = null; if ($this->validateMarker($model, $key, $index)) { $LatLng = new LatLng(['lat' => $model[$this->markerConfig['lat']], 'lng' => $model[$this->markerConfig['lng']]]); $marker = new Marker(['position' => $LatLng, 'title' => $model->__toString()]); $marker->attachInfoWindow(new InfoWindow(['content' => $this->renderItem($model, $key, $index)])); } return $marker; }
</div> <!--div class="top-menu-item shake-scroll cursor" data-el="#map"> контакты <div class="underline"></div></div> <a href="http://stat.vgg.ru" target="_blank" class="no-decoration color-w stat">статистика</a--> <?php $this->beginBody(); ?> <!-- main body, remove div for height compability --> <?php echo $content; ?> <div id="map"> <?php $coord = new LatLng(['lat' => 48.751678, 'lng' => 44.478525]); $marker = new Marker(['position' => $coord, 'title' => 'My Home Town', 'icon' => '/img/map-pin.png']); $marker->attachInfoWindow(new InfoWindow(['content' => '<div>' . '<h2>Унико</h2>' . '<b>Адрес</b>: г.Волгоград, ул. Землячки 30а, 5 подъезд, код домофона 42<br>' . '<b>Унико</b> – интернет ‐ провайдер и оператор связи в Волгоградской области.' . '</div>'])); $map = new Map(['width' => '100%', 'height' => '100%', 'center' => $coord, 'zoom' => 17, 'scrollwheel' => false, 'panControl' => false, 'mapTypeControl' => false, 'streetViewControl' => false, 'styles' => '[{"stylers":[{"saturation":-100},{"gamma":1}]},{"elementType":"labels.text.stroke","stylers":[{"visibility":"off"}]},{"featureType":"poi.business","elementType":"labels.text","stylers":[{"visibility":"off"}]},{"featureType":"poi.business","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"poi.place_of_worship","elementType":"labels.text","stylers":[{"visibility":"off"}]},{"featureType":"poi.place_of_worship","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"geometry","stylers":[{"visibility":"simplified"}]},{"featureType":"water","stylers":[{"visibility":"on"},{"saturation":50},{"gamma":0},{"hue":"#50a5d1"}]},{"featureType":"administrative.neighborhood","elementType":"labels.text.fill","stylers":[{"color":"#333333"}]},{"featureType":"road.local","elementType":"labels.text","stylers":[{"weight":0.5},{"color":"#333333"}]},{"featureType":"transit.station","elementType":"labels.icon","stylers":[{"gamma":1},{"saturation":50}]}]']); $map->addOverlay($marker); echo $map->display(); ?> </div> <footer class="main-footer"> <div> <div class="row"> <div class="col-lg-5"> <h3>О нас</h3> <p> Компания УНИКО является <strong>интернет-провайдером в Волгоградской области</strong>. На базе собственной волоконно-оптической и широкополосной беспроводной сети мы предлагаем интегрированные телекоммуникационные решения для разных категорий клиентов.
$home = new LatLng(['lat' => 15.9, 'lng' => 99.91180171966555]); $school = new LatLng(['lat' => 39.719456079114956, 'lng' => 2.8979293346405166]); $santo_domingo = new LatLng(['lat' => 39.72118906848983, 'lng' => 2.907628202438368]); // setup just one waypoint (Google allows a max of 8) $waypoints = [new DirectionsWayPoint(['location' => $santo_domingo])]; $directionsRequest = new DirectionsRequest(['origin' => $home, 'destination' => $school, 'waypoints' => $waypoints, 'travelMode' => TravelMode::DRIVING]); // Lets configure the polyline that renders the direction $polylineOptions = new PolylineOptions(['strokeColor' => '#FFAA00', 'draggable' => true]); // Now the renderer $directionsRenderer = new DirectionsRenderer(['map' => $map->getName(), 'polylineOptions' => $polylineOptions]); // Finally the directions service $directionsService = new DirectionsService(['directionsRenderer' => $directionsRenderer, 'directionsRequest' => $directionsRequest]); // Thats it, append the resulting script to the map $map->appendScript($directionsService->getJs()); // Lets add a marker now $marker = new Marker(['position' => $coord, 'title' => 'My Home Town']); // Provide a shared InfoWindow to the marker $marker->attachInfoWindow(new InfoWindow(['content' => '<p>ทดสอบ</p>'])); // Add marker to the map $map->addOverlay($marker); // Now lets write a polygon $coords = [new LatLng(['lat' => 25.774252, 'lng' => -80.190262]), new LatLng(['lat' => 18.466465, 'lng' => -66.118292]), new LatLng(['lat' => 32.321384, 'lng' => -64.75736999999999]), new LatLng(['lat' => 25.774252, 'lng' => -80.190262])]; $polygon = new Polygon(['paths' => $coords]); // Add a shared info window $polygon->attachInfoWindow(new InfoWindow(['content' => '<p>This is my super cool Polygon</p>'])); // Add it now to the map $map->addOverlay($polygon); // Lets show the BicyclingLayer :) $bikeLayer = new BicyclingLayer(['map' => $map->getName()]); // Append its resulting script $map->appendScript($bikeLayer->getJs());
use frontend\components\PageContent; use frontend\utilities\MaterializeActiveForm; use yii\helpers\Html; use yii\captcha\Captcha; use yii\helpers\Url; use yii\widgets\Breadcrumbs; BasicContentAsset::register($this); $this->title = Yii::t('front', 'our contacts'); $breadcrumbs = [['label' => $this->title]]; $template = "\n{input}\n{label}\n{hint}\n{error}"; $data = [['title' => 'Technické služby Dačice s.r.o.', 'lat' => 49.08716, 'lng' => 15.434929, 'url' => 'http://www.tsdacice.cz']]; $center = new LatLng(['lat' => $data[0]['lat'], 'lng' => $data[0]['lng']]); $map = new Map(['width' => '100%', 'height' => 400, 'center' => $center, 'zoom' => 16]); foreach ($data as $item) { $coord = new LatLng(['lat' => $item['lat'], 'lng' => $item['lng']]); $marker = new Marker(['position' => $coord, 'title' => $item['title']]); $marker->attachInfoWindow(new InfoWindow(['content' => Html::a($item['title'], $item['url'])])); $map->addOverlay($marker); } ?> <section> <div class="container"> <div class="page-title"> <h2> <?php echo Breadcrumbs::widget(['homeLink' => ['label' => Yii::t('front', 'home'), 'url' => Yii::$app->homeUrl], 'activeItemTemplate' => "<span>{link}</span>", 'itemTemplate' => "<span>{link}</span>", 'links' => $breadcrumbs, 'tag' => 'div', 'options' => ['class' => 'breadcrumbs']]); ?> <?php echo ucfirst($this->title); ?>
/** * @return LatLng|null */ public function getMarkersCenterCoordinates() { return Marker::getCenterOfMarkers($this->getMarkers()); }
<div class="col-lg-12"> <span id="kontakt"></span> <h2 class="font-effect-emboss" style="color: #7f7f7f;font-family: 'Francois One', sans-serif;margin-left:21%;padding-top:50px;font-size:2.9em">KONTAKT</h2><br /> <div id="nen-contact" style="margin-bottom:10px;border:none"> <div class="container"> <div class="row"> <div class="col-md-8 location"> <div class="contact-map" id="map-canvas" style="border: 1px solid #a3a3a3;"> <?php $coord = new LatLng(['lat' => 44.834209, 'lng' => 20.414084]); $map = new Map(['center' => $coord, 'zoom' => 16, 'width' => 'auto', 'height' => 430]); $home = new LatLng(['lat' => 44.833513, 'lng' => 20.40916]); // $map->appendScript($directionsService->getJs()); $marker = new Marker(['position' => $coord, 'title' => 'Life Fitnes Centar']); $marker->attachInfoWindow(new InfoWindow(['content' => '<img border="0" align="center" src="/images/objekat.jpg" width="222">'])); $map->addOverlay($marker); ?> <?php echo $map->display(); ?> </div> <div class="clearfix"></div> </div> <div class="col-md-4 contact_right" style="margin-top: 10px"> <div class="row" style="margin-top: -20px;margin-left: 8px"> <br /> <p style="float: left"><strong>Adresa : </strong><img src="/images/icon1.png" alt="icon 1" width="25px" />Džona Kenedija 10G, 11080 Srbija Zemun</p> <p style="float: left"><strong>Telefon : </strong><img src="/images/icon2.png" alt="icon 2" width="25px" />011/319-45-81</p><br />
echo $address['country'] . "<br/><br/>"; $i++; } ?> </div> <div class="col-md-8"> <?php $coord = new LatLng(['lat' => 39.720089311812096, 'lng' => 2.91165944519042]); $map = new Map(['center' => $coord, 'zoom' => 14]); foreach ($addressDataProvider->models as $address) { if (!is_null($address['latitude'])) { $latitude = $address['latitude']; $longitude = $address['longitude']; $coord = new LatLng(['lat' => $latitude, 'lng' => $longitude]); $marker = new Marker(['position' => $coord, 'title' => $model->name]); $marker->attachInfoWindow(new InfoWindow(['content' => '<p>' . $address['address1'] . '</p>'])); $map->addOverlay($marker); } } echo $map->display(); ?> </div> </div> </div> </div> </div> <div class="organization-job-view col-md-3 col-md-offset-half"> <?php
/** * Returns the boundaries of an array of Marker objects * @param Marker[] $markers * @param float $margin * @return LatLngBounds * @throws \yii\base\InvalidParamException */ public static function getBoundsOfMarkers($markers, $margin = 0.0) { $coords = []; foreach ($markers as $marker) { if (!$marker instanceof Marker) { throw new InvalidParamException('"$markers" must be an array of "' . Marker::className() . '" objects'); } $coords[] = $marker->position; } return LatLngBounds::getBoundsOfCoordinates($coords, $margin); }
use dosamigos\google\maps\LatLng; use dosamigos\google\maps\LatLngBounds; use dosamigos\google\maps\Map; use dosamigos\google\maps\overlays\InfoWindow; use dosamigos\google\maps\overlays\Marker; use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $locations common\models\Location[] */ /* @var $tickets [][] */ $this->title = 'Ticket Map'; $this->params['breadcrumbs'][] = ['label' => 'Tickets', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $markers = []; foreach ($locations as $location) { $marker = new Marker(['title' => $location->fullName, 'position' => new LatLng(['lat' => $location->lat, 'lng' => $location->lng])]); $content = '<h4>' . Html::a($location->fullName, ['/location/view', 'id' => $location->id]) . '</h4><hr>'; foreach ($tickets[$location->id] as $id => $title) { $content .= Html::a($title, ['view', 'id' => $id], ['class' => 'showModalButton']) . '<br>'; } $marker->attachInfoWindow(new InfoWindow(['content' => $content])); $markers[] = $marker; } $bounds = LatLngBounds::getBoundsOfMarkers($markers); $map = new Map(['center' => $bounds->getCenterCoordinates(), 'zoom' => $bounds->getZoom(250), 'width' => '100%', 'height' => '100%']); foreach ($markers as $marker) { $map->addOverlay($marker); } ?> <div class="ticket-map">
use yii\helpers\Html; use yii\helpers\Url; use app\widgets\ActionsDropdown; use app\widgets\grid\GridView; $this->title = Yii::t('app', 'Partners on map'); $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Partners'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; use dosamigos\google\maps\LatLng; use dosamigos\google\maps\services\DirectionsWayPoint; use dosamigos\google\maps\services\TravelMode; use dosamigos\google\maps\overlays\PolylineOptions; use dosamigos\google\maps\services\DirectionsRenderer; use dosamigos\google\maps\services\DirectionsService; use dosamigos\google\maps\overlays\InfoWindow; use dosamigos\google\maps\overlays\Marker; use dosamigos\google\maps\Map; use dosamigos\google\maps\services\DirectionsRequest; use dosamigos\google\maps\overlays\Polygon; use dosamigos\google\maps\layers\BicyclingLayer; $coord = new LatLng(['lat' => 39.720089311812096, 'lng' => 2.91165944519042]); $map = new Map(['center' => $coord, 'zoom' => 14, 'width' => 1140, 'height' => 600]); // pd($map); // Lets add a marker now $marker = new Marker(['position' => $coord, 'title' => 'My Home Town']); // Provide a shared InfoWindow to the marker $marker->attachInfoWindow(new InfoWindow(['content' => '<p>This is my super cool content</p>'])); // Add marker to the map $map->addOverlay($marker); // Display the map -finally :) echo $map->display();
<?php use dosamigos\google\maps\LatLng; use dosamigos\google\maps\overlays\InfoWindow; use dosamigos\google\maps\overlays\Marker; use dosamigos\google\maps\Map; $coord = new LatLng(['lat'=>13.777234,'lng'=>100.561981]); $map = new Map([ 'center'=>$coord, 'zoom'=>12, 'width'=>'100%', 'height'=>'600', ]); foreach($contacts as $c){ $coords = new LatLng(['lat'=>$c->lat,'lng'=>$c->lng]); $marker = new Marker(['position'=>$coords]); $marker->attachInfoWindow( new InfoWindow([ 'content'=>' <h4>'.$c->firstname.' '.$c->lastname.'</h4> <table class="table table-striped table-bordered table-hover"> <tr> <td>ที่อยู่</td> <td>'.$c->address.'</td> </tr> <tr> <td>ตำบล</td> <td>'.$c->tambon->tambon_name.'</td> </tr> <tr> <td>อำเภอ</td>
use dosamigos\google\maps\overlays\Polygon; use dosamigos\google\maps\overlays\InfoWindow; $this->title = $model->ALAMAT; $this->params['breadcrumbs'][] = ['label' => 'Customerskats', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <h1><?php echo Html::encode($this->title); ?> </h1> <div class="col-sm-12"> <?php if (!$model->MAP_LNG == NULL) { $coord = new LatLng(['lat' => $model->MAP_LAT, 'lng' => $model->MAP_LNG]); $map = new Map(['center' => $coord, 'zoom' => 20, 'width' => 1000, 'height' => 500]); $marker = new Marker(['position' => $coord, 'title' => $model->CUST_NM]); // Add marker to the map $marker->attachInfoWindow(new InfoWindow(['content' => $model->CUST_NM])); $map->addOverlay($marker); echo $map->display(); } else { echo 'No location coordinates for this place could be found.'; } ?> </div> <!-- end second col --> <?php echo Html::a('Back', ['index'], ['class' => 'btn btn-primary']); ?>
use dosamigos\google\maps\Map; use dosamigos\google\maps\overlays\InfoWindow; use dosamigos\google\maps\overlays\Marker; use frontend\utilities\FrontEndHelper; use pavlinter\display\DisplayImage; $this->title = $menuContent->title; $this->params['menuContent'] = $menuContent; $page = $menuContent->content; /** @noinspection PhpUndefinedFieldInspection */ $this->context->layout = 'pool-position-content'; $data = [['title' => Yii::t('front', 'Aquapark of Dačice'), 'lat' => 49.083191, 'lng' => 15.422774]]; $center = new LatLng(['lat' => 49.083191, 'lng' => 15.422774]); $map = new Map(['width' => '100%', 'height' => 400, 'center' => $center, 'zoom' => 16]); foreach ($data as $item) { $coord = new LatLng(['lat' => $item['lat'], 'lng' => $item['lng']]); $marker = new Marker(['position' => $coord, 'title' => $item['title']]); $marker->attachInfoWindow(new InfoWindow(['content' => $item['title']])); $map->addOverlay($marker); } echo '<div class="row"><div class="col s12">'; echo $map->display(); echo '</div></div>'; if ($page->image) { echo DisplayImage::widget(['options' => ['class' => 'responsive-img', 'title' => $menuContent->title], 'category' => 'all', 'image' => $page->image->filename]); } if ($page->perex) { echo '<div class="perex">' . $page->perex . '</div>'; } if ($page->description) { echo '<div class="description">'; echo FrontEndHelper::parseContent($page->description);