Create rectangle

[Open in new Window]

include_once('../../GoogleMapsPHP/Classes/Core/Bootstrap.php');

$map = \AdGrafik\GoogleMapsPHP\Utility\ClassUtility::makeInstance('AdGrafik\\GoogleMapsPHP\\MapBuilder');

$map->add('Rectangle', array(
	'bounds' => '49.208202, 14.873749, 47.208202, 17.873749',
	'fillColor' => 'red',
	'fillOpacity' => .25,
	'strokeColor' => 'red',
	'infoWindow' => array(
		'content' => '<strong>Hello</strong> World!',
		'closeOnClickAgain' => TRUE,
	),
));

echo $map;

There are three ways to attach info windows to a shape

  1. You can attach an info window to the shape by using the property infoWindow. In this example you see the position variable has the value 2, which means, that the info window will be attached to the second angle of the shape.
  2. The second option to set a position for the info window is to define an explicit LatLng-position like '48.0, 16.0'.
  3. If you don't set any position, like in the example below, the info window will be attached to the center of the shape by default.

Create circle

[Open in new Window]

include_once('../../GoogleMapsPHP/Classes/Core/Bootstrap.php');

$map = \AdGrafik\GoogleMapsPHP\Utility\ClassUtility::makeInstance('AdGrafik\\GoogleMapsPHP\\MapBuilder');

$map->add('Circle', array(
	'center' => '48.208202, 16.373749',
	'radius' => '100000',
	'fillColor' => 'red',
	'fillOpacity' => .25,
	'strokeColor' => 'red',
	'infoWindow' => array(
		'content' => '<strong>Hello</strong> World!',
		'closeOnClickAgain' => TRUE,
	),
));

echo $map;