Login   Register  
PHP Classes
elePHPant
Icontem

File: ex7.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Vagharshak Tozalakyan  >  Map Builder  >  ex7.php  >  Download  
File: ex7.php
Role: Example script
Content type: text/plain
Description: Example 7 - Using Geolocation service.
Class: Map Builder
Display maps using Google Maps API v3
Author: By
Last change:
Date: 2012-07-15 15:58
Size: 958 bytes
 

Contents

Class file image Download
<?php

// Include MapBuilder class.
require_once 'class.MapBuilder.php';

// Create MapBuilder object.
$map = new MapBuilder();

// Set map's center position by latitude and longitude coordinates. 
$map->setCenter(48.8601812.3249648);

// Set the default map type.
$map->setMapTypeId(MapBuilder::MAP_TYPE_ID_ROADMAP);

// Set width and height of the map.
$map->setSize(800500);

// Set default zoom level.
$map->setZoom(14);

// Enable sensor. 
// It's not required, as the sensor will turned on automatically by the following 2 methods.
$map->setSensor(true);

// Add marker at location returned by GPS sensor.
$map->addGeoMarker(array(
    
'html' => '<b>Hey, it\'s my location!</b>'
    
'defColor' => '#FF6161'
    
'defSymbol' => '%E2%80%A2',
    
'infoCloseOthers' => true     
));

// Make location returned by GPS sensor the map center.
$map->overrideCenterByGeo(true);

// Display the map.
$map->show();

?>