PHP Classes

File: ex7.php

Recommend this page to a friend!
  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: Added API key.
Date: 6 years ago
Size: 1,037 bytes


Class file image Download

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

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

// Set API key

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

// Set the default map type.

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

// Set default zoom level.

// Enable sensor.
// It's not required, as the sensor will turned on automatically by the following 2 methods.

// Add marker at location returned by GPS sensor.
'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.

// Display the map.