File: ex3.php

Recommend this page to a friend!
  Classes of Vagharshak Tozalakyan  >  Map Builder  >  ex3.php  >  Download  
File: ex3.php
Role: Example script
Content type: text/plain
Description: Example 3 - Playing with controls.
Class: Map Builder
Display maps using Google Maps API v3
Author: By
Last change: Added API key.
Date: 4 years ago
Size: 2,305 bytes


Class file image Download

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

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

// Set API key

// Retrieve coordinates of address.
try {
$pos = $map->getLatLng('Eiffel Tower, Paris', MapBuilder::URL_FETCH_METHOD_SOCKETS);
} catch (
MapBuilderException $ex) {

// Set map's center position by latitude and longitude coordinates.
$map->setCenter($pos['lat'], $pos['lng']);

// Add a marker with specified color and symbol.
$map->addMarker($pos['lat'], $pos['lng'], array(
'title' => 'Eiffel Tower',
'defColor' => '#FA6D6D',
'defSymbol' => 'E'

// Set the default map type.

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

// Set default zoom level.

// Define map type control parameters.

// Define overview control parameters.

// Define pan control parameters.

// Define rotate control parameters.

// Define scale control parameters.

// Define street view control parameters.

// Define zoom control parameters.

// Display the map.


For more information send a message to info at phpclasses dot org.