include_once('../../GoogleMapsPHP/Classes/Core/Bootstrap.php'); $map = \AdGrafik\GoogleMapsPHP\Utility\ClassUtility::makeInstance('AdGrafik\\GoogleMapsPHP\\MapBuilder'); echo $map;
include_once('../../GoogleMapsPHP/Classes/Core/Bootstrap.php'); $map = \AdGrafik\GoogleMapsPHP\Utility\ClassUtility::makeInstance('AdGrafik\\GoogleMapsPHP\\MapBuilder', array( 'center' => '48.208202, 16.373749', 'backgroundColor' => 'yellow', 'mapTypeId' => \AdGrafik\GoogleMapsPHP\API\Map\MapTypeId::TERRAIN, 'zoom' => '12', 'mapTypeControlOptions' => array( 'mapTypeIds' => array( \AdGrafik\GoogleMapsPHP\API\Map\MapTypeId::TERRAIN, \AdGrafik\GoogleMapsPHP\API\Map\MapTypeId::ROADMAP, ), ), )); echo $map;
Setting map properties and map styles like in this example.
include_once('../../GoogleMapsPHP/Classes/Core/Bootstrap.php'); $map = \AdGrafik\GoogleMapsPHP\Utility\ClassUtility::makeInstance('AdGrafik\\GoogleMapsPHP\\MapBuilder', array( 'center' => '48.208202, 16.373749', 'mapTypeId' => \AdGrafik\GoogleMapsPHP\API\Map\MapTypeId::TERRAIN, 'zoom' => 12, 'mapTypeControlOptions' => array( 'mapTypeIds' => array( \AdGrafik\GoogleMapsPHP\API\Map\MapTypeId::ROADMAP, 'road_atlas', ), ), )); $map->add('StyledMapType', array( 'id' => 'road_atlas', 'name' => 'Road Atlas', 'alt' => 'Show the Road Atlas', 'showOnInitialize' => TRUE, 'styles' => array( array( 'featureType' => 'road.highway', 'elementType' => 'geometry', 'stylers' => array( array( 'hue' => '#ff0022', ), array( 'saturation' => 60, ), array( 'lightness' => -20, ), ), ), array( 'featureType' => 'road.arterial', 'elementType' => 'all', 'stylers' => array( array( 'hue' => '#2200ff', ), array( 'lightness' => -40, ), array( 'visibility' => 'simplified', ), array( 'saturation' => 30, ), ), ), array( 'featureType' => 'road.local', 'elementType' => 'all', 'stylers' => array( array( 'hue' => '#f6ff00', ), array( 'saturation' => 50, ), array( 'gamma' => 0.7, ), array( 'visibility' => 'simplified', ), ), ), array( 'featureType' => 'water', 'elementType' => 'geometry', 'stylers' => array( array( 'saturation' => 40, ), array( 'lightness' => 40, ), ), ), array( 'featureType' => 'road.highway', 'elementType' => 'labels', 'stylers' => array( array( 'visibility' => 'on', ), array( 'saturation' => 98, ), ), ), array( 'featureType' => 'administrative.locality', 'elementType' => 'labels', 'stylers' => array( array( 'hue' => '#0022ff', ), array( 'saturation' => 50, ), array( 'lightness' => -10, ), array( 'gamma' => 0.9, ), ), ), array( 'featureType' => 'transit.line', 'elementType' => 'geometry', 'stylers' => array( array( 'hue' => '#ff0000', ), array( 'visibility' => 'on', ), array( 'lightness' => -70, ), ), ), ), )); echo $map;