Google Map using php and javascript


ashokg165

<?php

class GoogleMaps
{

var $APIKey = “ABQIAAAASTe3RGQOzgfE_7pgalxCWxTxwC-FTRouMUU4URT3KGgoa5PSihROzcGmVudxV_XFjm17uSpKPwoCYw”;

function SetLocation($Location)
{
$this->Location = $Location;
}
function SetWidth($Width)
{
$this->Width = $Width;
}
function SetHeight($Height)
{
$this->Height = $Height;
}
function DisplayGoogleMaps()
{
?>


var JobLocationInGoogleMaps = ‘Location; ?>’;
if (GBrowserIsCompatible())
{
var geocoder = new GClientGeocoder();
geocoder.getLocations(JobLocationInGoogleMaps, function (locations)
{
if (locations.Placemark)
{
var north = locations.Placemark[0].ExtendedData.LatLonBox.north;
var south = locations.Placemark[0].ExtendedData.LatLonBox.south;
var east = locations.Placemark[0].ExtendedData.LatLonBox.east;
var west = locations.Placemark[0].ExtendedData.LatLonBox.west;

var bounds = new GLatLngBounds(new GLatLng(south, west), new GLatLng(north, east));
var map = new GMap2(document.getElementById(“GoogleMapCanvasHere”));
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addOverlay(new GMarker(bounds.getCenter()));
}
});
}
GUnload();

Width; ?>px; height:Height; ?>px; background: url(./images/google-maps-loading.gif); background-repeat:no-repeat; background-position:center;”>

<?php
}
}

$maps = new GoogleMaps();
$maps->SetLocation(“Phase 5, Mohali, India”); // Change Location
$maps->SetWidth(500); // Chaneg Map Width
$maps->SetHeight(350); // Change Map Height
$maps->DisplayGoogleMaps();

?>

View original post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s