PHP Classes

File: ex12.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Vagharshak Tozalakyan  >  Map Builder  >  ex12.php  >  Download  
File: ex12.php
Role: Example script
Content type: text/plain
Description: Using directions service.
Class: Map Builder
Display maps using Google Maps API v3
Author: By
Last change: Small fixes.
Date: 1 year ago
Size: 2,287 bytes


Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-script-type" content="text/javascript" />
<meta http-equiv="imagetoolbar" content="no" />

<title>Map Builder Example</title>

<script type="text/javascript">
Create a JavaScript gag function which will be called after map initialization.
The name of the function should be mbOnAfterInit().
function mbOnAfterInit(map) {
    var directionsDisplay = new google.maps.DirectionsRenderer();
    var directionsService = new google.maps.DirectionsService();
    var request = {
        origin: "Eifel Tower, Paris, France",
        destination: "Promenade Plantee, Paris, France",
        waypoints: [{
            location: "Jardin du Luxembourg, Paris, France",
            stopover: true
        }, {
            location: "Musee d'Orsay, Paris, France",
            stopover: true
        }, {
            location: "The Louvre, Paris, France",
            stopover: true
        optimizeWaypoints: true,
        travelMode: google.maps.TravelMode["DRIVING"]
    directionsService.route(request, function(result, status) {
        if (status == google.maps.DirectionsStatus.OK) {
        } else {
            alert("Sorry, we couldn't route from your location!");




// 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.860181, 2.3249648);

// Set the default map type.

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

// Set default zoom level.

// Make zoom control compact.

// Display the map.