Beispiel #1
0
		    lat = results[0].geometry.location;
	        return results[0].geometry.location;	        
	      } else {
	        return ;
	      }
	    });
	  }	  
</script> <?php 
Yii::import('ext.gmaps.*');
?>
 <?php 
$gMap = new EGMap();
$gMap->setWidth(625);
$gMap->setHeight(350);
$gMap->zoom = 14;
$gMap->setOptions(array('zoomControl' => true, 'scaleControl' => true, 'disableDefaultUI' => true, 'panControl' => true, 'draggable' => true, 'scrollwheel' => true));
if ($property->latitude && $property->longitude) {
    $marker = new EGMapMarker($property->latitude, $property->longitude);
    $gMap->addMarker($marker);
    $gMap->setCenter($property->latitude, $property->longitude);
} elseif ($propertyAddress['country']) {
    $country = $gMap->geocode($propertyAddress['city'] . "," . $propertyAddress['state'] . "," . $propertyAddress['country']);
    if ($country) {
        if ($country->getLat() && $country->getLng()) {
            $marker = new EGMapMarker($country->getLat(), $country->getLng());
            $gMap->addMarker($marker);
            $gMap->setCenter($country->getLat(), $country->getLng());
        }
    }
}
$gMap->renderMap();