Display markers of surrounding place on google map


STEP :1 :  Database Schema

— phpMyAdmin SQL Dump
— version 3.2.4
http://www.phpmyadmin.net

— Host: localhost
— Generation Time: Jul 05, 2011 at 12:37 PM
— Server version: 5.1.41
— PHP Version: 5.3.1

SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”;


— Database: `test`

— ——————————————————–


— Table structure for table `markers`

CREATE TABLE IF NOT EXISTS `markers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(60) NOT NULL,
`address` varchar(80) NOT NULL,
`lat` float(10,6) NOT NULL,
`lng` float(10,6) NOT NULL,
`type` varchar(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=172 ;


— Dumping data for table `markers`

INSERT INTO `markers` (`id`, `name`, `address`, `lat`, `lng`, `type`) VALUES
(1, ‘Frankie Johnnie & Luigo Too’, ‘939 W El Camino Real, Mountain View, CA’, 37.386337, -122.085823, ”),
(2, ‘Amici”s East Coast Pizzeria’, ‘790 Castro St, Mountain View, CA’, 37.387138, -122.083237, ”),
(3, ‘Kapp”s Pizza Bar & Grill’, ‘191 Castro St, Mountain View, CA’, 37.393887, -122.078918, ”),
(4, ‘Round Table Pizza: Mountain View’, ‘570 N Shoreline Blvd, Mountain View, CA’, 37.402653, -122.079353, ”),
(5, ‘Tony & Alba”s Pizza & Pasta’, ‘619 Escuela Ave, Mountain View, CA’, 37.394012, -122.095528, ”),
(6, ‘Oregano”s Wood-Fired Pizza’, ‘4546 El Camino Real, Los Altos, CA’, 37.401726, -122.114647, ”),
(7, ‘Round Table Pizza: Sunnyvale-Mary-Central Expy’, ‘415 N Mary Ave, Sunnyvale, CA’, 37.390038, -122.042030, ”),
(8, ‘Giordano”s’, ‘730 N Rush St, Chicago, IL’, 41.895729, -87.625412, ”),
(9, ‘Filippi”s Pizza Grotto’, ‘1747 India St, San Diego, CA’, 32.723831, -117.168327, ”),
(10, ‘Lou Malnati”s Pizzeria’, ‘439 N Wells St, Chicago, IL’, 41.890347, -87.633926, ”),
(11, ‘Sammy”s Woodfired Pizza’, ‘770 4th Ave, San Diego, CA’, 32.713383, -117.161179, ”),
(12, ‘Casa Bianca Pizza Pie’, ‘1650 Colorado Blvd, Los Angeles, CA’, 34.139160, -118.204605, ”),
(13, ‘Parkway Grill’, ‘510 S Arroyo Pkwy, Pasadena, CA’, 34.137005, -118.147301, ”),
(14, ‘Pizzeria Paradiso’, ‘2029 P St NW, Washington, DC’, 38.909649, -77.045898, ”),
(15, ‘Star Pizza’, ‘2111 Norfolk St, Houston, TX’, 29.732452, -95.411057, ”),
(16, ‘Tutta Bella Neapolitan Pizzera’, ‘4918 Rainier Ave S, Seattle, WA’, 47.557705, -122.284988, ”),
(17, ‘Touche Pasta Pizza Pool’, ‘1425 NW Glisan St, Portland, OR’, 45.526466, -122.685577, ”),
(18, ‘Piecora”s New York Pizza’, ‘1401 E Madison St, Seattle, WA’, 47.614006, -122.313988, ”),
(19, ‘Pagliacci Pizza’, ‘550 Queen Anne Ave N, Seattle, WA’, 47.623943, -122.356720, ”),
(20, ‘Zeeks Pizza – Phinney Ridge’, ‘6000 Phinney Ave N, Seattle, WA’, 47.672668, -122.354095, ”),
(21, ‘Old Town Pizza’, ‘226 NW Davis St, Portland, OR’, 45.524555, -122.672684, ”),
(22, ‘Zeeks Pizza – Belltown’, ‘419 Denny Way, Seattle, WA’, 47.618313, -122.348000, ”),
(23, ‘Escape From New York Pizza’, ‘622 NW 23rd Ave, Portland, OR’, 45.527103, -122.698509, ”),
(24, ‘Big Fred”s Pizza Garden’, ‘1101 S 119th St, Omaha, NE’, 41.248661, -96.098763, ”),
(25, ‘Old Chicago’, ‘1111 Harney St, Omaha, NE’, 41.256519, -95.930679, ”),
(26, ‘Sgt Peffer”s Cafe Italian’, ‘1501 N Saddle Creek Rd, Omaha, NE’, 41.273083, -95.987816, ”),
(27, ‘Mama”s Pizza’, ‘715 N Saddle Creek Rd, Omaha, NE’, 41.265884, -95.980682, ”),
(28, ‘Zio”s New York Style Pizzeria’, ‘1213 Howard St, Omaha, NE’, 41.255451, -95.932022, ”),
(29, ‘Boston”s Restaurant & Sports’, ‘620 E Disk Dr, Rapid City, SD’, 44.106937, -103.205223, ”),
(30, ‘Zio”s New York Style Pizzeria’, ‘7834 W Dodge Rd, Omaha, NE’, 41.263248, -96.056396, ”),
(31, ‘La Casa Pizzaria’, ‘4432 Leavenworth St, Omaha, NE’, 41.252399, -95.979576, ”),
(32, ‘Giordano”s’, ‘730 N Rush St, Chicago, IL’, 41.895729, -87.625412, ”),
(33, ‘Lou Malnati”s Pizzeria’, ‘439 N Wells St, Chicago, IL’, 41.890347, -87.633926, ”),
(34, ‘Piece Restaurant’, ‘1927 W North Ave, Chicago, IL’, 41.910492, -87.676125, ”),
(35, ‘Connie”s Pizza Inc’, ‘2373 S Archer Ave, Chicago, IL’, 41.849213, -87.641678, ”),
(36, ‘Exchequer Restaurant’, ‘226 S Wabash Ave, Chicago, IL’, 41.879189, -87.626076, ”),
(37, ‘Coco”s By The Falls’, ‘5339 Murray Street, Niagara Falls, Ontario’, 43.083553, -79.082703, ”),
(38, ‘Pompei’, ‘1531 W Taylor St, Chicago, IL’, 41.869301, -87.664780, ”),
(39, ‘Lynn”s Paradise Cafe’, ‘984 Barret Ave, Louisville, KY’, 38.236931, -85.728539, ”),
(40, ‘Otto Restaurant Enoteca Pizza’, ‘1 5th Ave, New York, NY’, 40.732162, -73.996323, ”),
(41, ‘Grimaldi”s’, ’19 Old Fulton St, Brooklyn, NY’, 40.702515, -73.993736, ”),
(42, ‘Lombardi”s’, ’32 Spring St, New York, NY’, 40.721676, -73.995598, ”),
(43, ‘John”s Pizzeria’, ‘278 Bleecker St, New York, NY’, 40.731705, -74.003273, ”),
(44, ‘John”s Pizzeria’, ‘260 W 44th St, New York, NY’, 40.758072, -73.987740, ”),
(45, ‘Burger Joint’, ‘2175 Broadway, New York, NY’, 40.782398, -73.981003, ”),
(46, ‘Frank Pepe Pizzeria Napoletana’, ‘157 Wooster St, New Haven, CT’, 41.302803, -72.917046, ”),
(47, ‘Adrianne”s Pizza Bar’, ’54 Stone St, New York, NY’, 40.704479, -74.010139, ”),
(48, ‘Pizzeria Regina: Regina Pizza’, ’11 1/2 Thacher St, Boston, MA’, 42.365337, -71.056831, ”),
(49, ‘Upper Crust’, ’20 Charles St, Boston, MA’, 42.356606, -71.069679, ”),
(50, ‘Bertucci”s Brick Oven Rstrnt’, ‘4 Brookline Pl, Brookline, MA’, 42.331917, -71.115311, ”),
(51, ‘Aquitaine’, ‘569 Tremont St, Boston, MA’, 42.343636, -71.072266, ”),
(52, ‘Bertucci”s Brick Oven Rstrnt’, ’43 Stanhope St, Boston, MA’, 42.348297, -71.073250, ”),
(53, ‘Upper Crust’, ‘286 Harvard St, Brookline, MA’, 42.342857, -71.122314, ”),
(54, ‘Bertucci”s Brick Oven Rstrnt’, ‘799 Main St, Cambridge, MA’, 42.363258, -71.097214, ”),
(55, ‘Bertucci”s Brick Oven Rstrnt’, ’22 Merchants Row, Boston, MA’, 42.359146, -71.055473, ”),
(56, ‘Vinnie Van Go-Go”s’, ‘317 W Bryan St, Savannah, GA’, 32.081154, -81.094994, ”),
(57, ‘Domino”s Pizza: Myrtle Beach’, ‘1706 S Kings Hwy # A, Myrtle Beach, SC’, 33.674881, -78.905144, ”),
(58, ‘East of Chicago Pizza Company’, ‘3901 North Kings Highway Suite 1, Myrtle Beach, SC’, 33.716099, -78.855583, ”),
(59, ‘Villa Tronco Italian Rstrnt’, ‘1213 Blanding St, Columbia, SC’, 34.008049, -81.036316, ”),
(60, ‘Mellow Mushroom Pizza Bakers’, ’11 W Liberty St, Savannah, GA’, 32.074673, -81.093697, ”),
(61, ‘Andolinis Pizza’, ’82 Wentworth St, Charleston, SC’, 32.782330, -79.934235, ”),
(62, ‘Mellow Mushroom Pizza Bakers’, ‘259 E Broad St, Athens, GA’, 33.957802, -83.374657, ”),
(63, ‘Bucks Pizza of Edisto Beach Inc’, ‘114 Jungle Rd, Edisto Island, SC’, 32.503971, -80.297951, ”),
(64, ‘Anthony”s Coal Fired Pizza’, ‘2203 S Federal Hwy, Fort Lauderdale, FL’, 26.094671, -80.136688, ”),
(65, ‘Giordano”s’, ‘12151 S Apopka Vineland Rd, Orlando, FL’, 28.389366, -81.506226, ”),
(66, ‘Pizza Rustica’, ‘863 Washington Ave, Miami Beach, FL’, 25.779058, -80.133110, ”),
(67, ‘Mama Jennie”s Italian Restaurant’, ‘11720 Ne 2nd Ave, North Miami, FL’, 25.882782, -80.194290, ”),
(68, ‘Anthony”s Coal Fired Pizza’, ‘17901 Biscayne Blvd, Aventura, FL’, 25.941116, -80.148827, ”),
(69, ‘Anthony”s Coal Fired Pizza’, ‘4527 Weston Rd, Weston, FL’, 26.065395, -80.362442, ”),
(70, ‘Mario the Baker Pizza & Italian Restaurant’, ‘13695 W Dixie Hwy, North Miami, FL’, 25.929741, -80.156090, ”),
(71, ‘Big Cheese Pizza’, ‘8080 SW 67th Ave, Miami, FL’, 25.696026, -80.301109, ”),
(72, ‘Ingleside Village Pizza’, ‘2396 Ingleside Ave, Macon, GA’, 32.853760, -83.657410, ”),
(73, ‘Ciao Bella Pizza Da Guglielmo’, ’29 Highway 98 E, Destin, FL’, 30.395555, -86.512093, ”),
(74, ‘Papa John”s Pizza’, ‘810 Russell Pkwy, Warner Robins, GA’, 32.593910, -83.637077, ”),
(75, ‘Papa John”s Pizza: East Central Montgomery’, ‘2525 Madison Ave, Montgomery, AL’, 32.381123, -86.273033, ”),
(76, ‘Cici”s Pizza’, ‘6268 Atlanta Hwy, Montgomery, AL’, 32.382206, -86.190674, ”),
(77, ‘Papa John”s Pizza’, ‘1210 E Jackson St, Thomasville, GA’, 30.849129, -83.963425, ”),
(78, ‘Papa John”s Pizza’, ‘711 N Westover Blvd # G, Albany, GA’, 31.613970, -84.223083, ”),
(79, ‘Mellow Mushroom Pizza Bakers’, ‘6100 Veterans Pkwy, Columbus, GA’, 32.532078, -84.955894, ”),
(80, ‘Star Pizza’, ‘2111 Norfolk St, Houston, TX’, 29.732452, -95.411057, ”),
(81, ‘Star Pizza II’, ’77 Harvard St, Houston, TX’, 29.770752, -95.396042, ”),
(82, ‘Brothers Pizzeria’, ‘1029 Highway 6 N # 100, Houston, TX’, 29.768337, -95.643593, ”),
(83, ’11th Street Cafe Inc’, ‘748 E 11th St, Houston, TX’, 29.790794, -95.388924, ”),
(84, ‘California Pizza Kitchen’, ‘1705 Post Oak Blvd # A, Houston, TX’, 29.750172, -95.461197, ”),
(85, ‘Collina”s Italian Cafe’, ‘3835 Richmond Ave, Houston, TX’, 29.732620, -95.438965, ”),
(86, ‘Barry”s Pizza & Italian Diner’, ‘6003 Richmond Ave, Houston, TX’, 29.731430, -95.484383, ”),
(87, ‘Mario”s Seawall Italian Restaurant’, ‘628 Seawall Blvd, Galveston, TX’, 29.304543, -94.772598, ”),
(88, ‘Campisi”s Egyptian Restaurant’, ‘5610 E Mockingbird Ln, Dallas, TX’, 32.836510, -96.771782, ”),
(89, ‘Fat Joe”s Pizza Pasta & Bar’, ‘4721 W Park Blvd # 101, Plano, TX’, 33.027054, -96.788910, ”),
(90, ‘Saccone”s Pizza’, ‘13812 N Highway 183, Austin, TX’, 29.569508, -97.964661, ”),
(91, ‘Fireside Pies’, ‘2820 N Henderson Ave, Dallas, TX’, 32.819763, -96.784149, ”),
(92, ‘Romeo”s’, ‘1500 Barton Springs Rd, Austin, TX’, 30.261526, -97.760025, ”),
(93, ‘Sandella”s Cafe’, ‘5910 N Macarthur Blvd, Irving, TX’, 32.892002, -96.961189, ”),
(94, ‘Mangia Chicago Stuffed Pizza’, ‘3500 Guadalupe St, Austin, TX’, 30.301542, -97.739113, ”),
(95, ‘Frank & Angie”s’, ‘508 West Ave, Austin, TX’, 30.269394, -97.750893, ”),
(96, ‘Filippi”s Pizza Grotto’, ‘1747 India St, San Diego, CA’, 32.723831, -117.168327, ”),
(97, ‘Pizzeria Bianco’, ‘623 E Adams St, Phoenix, AZ’, 33.449375, -112.065521, ”),
(98, ‘Sammy”s Woodfired Pizza’, ‘770 4th Ave, San Diego, CA’, 32.713383, -117.161179, ”),
(99, ‘Casa Bianca Pizza Pie’, ‘1650 Colorado Blvd, Los Angeles, CA’, 34.139160, -118.204605, ”),
(100, ‘Parkway Grill’, ‘510 S Arroyo Pkwy, Pasadena, CA’, 34.137005, -118.147301, ”),
(101, ‘California Pizza Kitchen’, ‘330 S Hope St, Los Angeles, CA’, 34.053329, -118.252686, ”),
(102, ‘B J”s Pizza & Grill’, ‘200 Main St # 101, Huntington Beach, CA’, 33.658058, -118.001099, ”),
(103, ‘B J”s Restaurant & Brewhouse’, ‘280 S Coast Hwy, Laguna Beach, CA’, 33.542091, -117.783516, ”),
(104, ‘Giuseppe”s Depot Restaurant’, ’10 S Sierra Madre St, Colorado Springs, CO’, 38.834549, -104.828300, ”),
(105, ‘Beau Jo”s Pizza’, ‘2710 S Colorado Blvd, Denver, CO’, 39.667343, -104.940704, ”),
(106, ‘Pasquini”s Pizzeria’, ‘1310 S Broadway, Denver, CO’, 39.692825, -104.987465, ”),
(107, ‘Fargos Pizza Co’, ‘2910 E Platte Ave, Colorado Springs, CO’, 38.839848, -104.774422, ”),
(108, ‘Old Chicago’, ‘1415 Market St, Denver, CO’, 39.748177, -105.000504, ”),
(109, ‘Sink’, ‘1165 13th St, Boulder, CO’, 40.008209, -105.276237, ”),
(110, ‘Ligori”s Pizza & Pasta’, ‘4421 Harrison Blvd, Ogden, UT’, 41.182732, -111.949196, ”),
(111, ‘Old Chicago’, ‘1102 Pearl St, Boulder, CO’, 40.017590, -105.280991, ”),
(112, ‘Boston”s Restaurant & Sports’, ‘620 E Disk Dr, Rapid City, SD’, 44.106937, -103.205223, ”),
(113, ‘Chuck E Cheese”s Pizza’, ‘100 24th St W # B, Billings, MT’, 45.771355, -108.576286, ”),
(114, ‘Space Aliens Grill & Bar’, ‘1304 E Century Ave, Bismarck, ND’, 46.838081, -100.771736, ”),
(115, ‘2nd Street Bistro’, ‘123 North 2nd Street, Livingston, MT’, 45.661015, -110.561424, ”),
(116, ‘Domino”s Pizza’, ‘1524 S Broadway # 1, Minot, ND’, 48.219658, -101.296036, ”),
(117, ‘American Classic Pizzeria’, ‘1744 Grand Ave, Billings, MT’, 45.784119, -108.560204, ”),
(118, ‘Godfather”s Pizza’, ‘905 Main St, Billings, MT’, 45.815079, -108.470757, ”),
(119, ‘Papa John”s Pizza’, ‘605 Main St, Billings, MT’, 45.810223, -108.472122, ”),
(120, ‘Aardvark Pizza & Sub’, ‘304A Caribou St, Banff, AB’, 51.176487, -115.570747, ”),
(121, ‘Jasper Pizza Place’, ‘402 Connaught Dr, Jasper, AB’, 52.879086, -118.079315, ”),
(122, ‘Odyssey Pizza & Steak House’, ‘3-3814 Bow Trail SW, Calgary, AB’, 51.045235, -114.141251, ”),
(123, ‘Basil”s Pizza’, ‘2118 33 Avenue SW, Calgary, AB’, 51.023979, -114.109901, ”),
(124, ‘Castle Pizza & Donair’, ‘7724 Elbow Drive SW, Calgary, AB’, 50.984497, -114.083153, ”),
(125, ‘Santa Lucia Italian Restaurant’, ‘714 8 St, Canmore, AB’, 51.089195, -115.358734, ”),
(126, ‘Tops Pizza & Steak House No 3’, ‘7-5602 4 Street NW, Calgary, AB’, 51.101204, -114.071457, ”),
(127, ‘Evvia Restaurant’, ‘837 Main St, Canmore, AB’, 51.089176, -115.361771, ”),
(128, ‘D’Bronx’, ‘3904 Bell St, Kansas City, MO’, 39.057182, -94.606102, ”),
(129, ‘Cicero”s Restaurant & Entrtnmt’, ‘6691 Delmar Blvd, St Louis, MO’, 38.656307, -90.308441, ”),
(130, ‘Hideaway Pizza’, ‘6616 N Western Ave, Oklahoma City, OK’, 35.539116, -97.529762, ”),
(131, ‘Fortel”s Pizza Den’, ‘7932 Mackenzie Rd, St Louis, MO’, 38.566441, -90.320793, ”),
(132, ‘Hideaway Pizza’, ‘7877 E 51st St, Tulsa, OK’, 36.089897, -95.889244, ”),
(133, ‘Farotto”s Catering’, ‘9525 Manchester Rd, Webster Groves, MO’, 38.609325, -90.364433, ”),
(134, ‘California Pizza Kitchen’, ‘1493 Saint Louis Galleria, St Louis, MO’, 38.633614, -90.345947, ”),
(135, ‘D”Bronx’, ‘2450 Grand Blvd # 124, Kansas City, MO’, 39.082722, -94.581779, ”),
(136, ‘Giuseppe”s Depot Restaurant’, ’10 S Sierra Madre St, Colorado Springs, CO’, 38.834549, -104.828300, ”),
(137, ‘Beau Jo”s Pizza’, ‘2710 S Colorado Blvd, Denver, CO’, 39.667343, -104.940704, ”),
(138, ‘Pasquini”s Pizzeria’, ‘1310 S Broadway, Denver, CO’, 39.692825, -104.987465, ”),
(139, ‘Fargos Pizza Co’, ‘2910 E Platte Ave, Colorado Springs, CO’, 38.839848, -104.774422, ”),
(140, ‘Old Chicago’, ‘1415 Market St, Denver, CO’, 39.748177, -105.000504, ”),
(141, ‘Sink’, ‘1165 13th St, Boulder, CO’, 40.008209, -105.276237, ”),
(142, ‘Old Chicago’, ‘1102 Pearl St, Boulder, CO’, 40.017590, -105.280991, ”),
(143, ‘Gondolier’, ‘1738 Pearl St, Boulder, CO’, 40.019344, -105.272949, ”),
(144, ‘Ligori”s Pizza & Pasta’, ‘4421 Harrison Blvd, Ogden, UT’, 41.182732, -111.949196, ”),
(145, ‘Brick Oven Restaurant’, ‘111 E 800 N, Provo, UT’, 40.244492, -111.656319, ”),
(146, ‘Zachary”s Chicago Pizza’, ‘5801 College Ave, Oakland, CA’, 37.846180, -122.251953, ”),
(147, ‘Zachary”s Chicago Pizza’, ‘1853 Solano Ave, Berkeley, CA’, 37.891407, -122.278427, ”),
(148, ‘Cheese Board Pizza’, ‘1512 Shattuck Ave, Berkeley, CA’, 37.879974, -122.269272, ”),
(149, ‘Goat Hill Pizza’, ‘300 Connecticut St, San Francisco, CA’, 37.762432, -122.397614, ”),
(150, ‘Tommaso Ristorante Italiano’, ‘1042 Kearny St, San Francisco, CA’, 37.797386, -122.405373, ”),
(151, ‘Little Star Pizza LLC’, ‘846 Divisadero St, San Francisco, CA’, 37.777519, -122.438217, ”),
(152, ‘Pauline”s Pizza’, ‘260 Valencia, San Francisco, CA’, 37.768726, -122.422241, ”),
(153, ‘Villa Romana Pizzeria & Rstrnt’, ‘731 Irving St, San Francisco, CA’, 37.764072, -122.465584, ”),
(154, ‘Amici”s East Coast Pizzeria’, ’69 E 3rd Ave, San Mateo, CA’, 37.563896, -122.324722, ”),
(155, ‘Amici”s East Coast Pizzeria’, ‘226 Redwood Shores Pkwy, Redwood City, CA’, 37.520515, -122.252258, ”),
(156, ‘North Beach Pizza’, ‘240 E 3rd Ave, San Mateo, CA’, 37.565327, -122.322639, ”),
(157, ‘Patxi”s Chicago Pizza’, ‘441 Emerson St, Palo Alto, CA’, 37.445148, -122.163551, ”),
(158, ‘Pizz”a Chicago’, ‘4115 El Camino Real, Palo Alto, CA’, 37.414104, -122.126221, ”),
(159, ‘California Pizza Kitchen’, ‘531 Cowper St, Palo Alto, CA’, 37.448074, -122.158813, ”),
(160, ‘Windy City Pizza’, ’35 Bovet Rd, San Mateo, CA’, 37.551563, -122.314522, ”),
(161, ‘Applewood Pizza 2 Go’, ‘1001 El Camino Real, Menlo Park, CA’, 37.452965, -122.181725, ”),
(162, ‘Pizza Antica’, ‘334 Santana Row # 1065, San Jose, CA’, 37.321793, -121.947739, ”),
(163, ‘Pizz”a Chicago’, ‘155 W San Fernando St, San Jose, CA’, 37.333279, -121.891678, ”),
(164, ‘House of Pizza’, ‘527 S Almaden Ave, San Jose, CA’, 37.326351, -121.888168, ”),
(165, ‘Amici”s East Coast Pizzeria’, ‘225 W Santa Clara St, San Jose, CA’, 37.334702, -121.894043, ”),
(166, ‘Fiorillo”s Restaurant’, ‘638 El Camino Real, Santa Clara, CA’, 37.354603, -121.942574, ”),
(167, ‘Tony & Alba”s Pizza & Pasta’, ‘3137 Stevens Creek Blvd, San Jose, CA’, 37.323296, -121.951645, ”),
(168, ‘Giorgio”s’, ‘1445 Foxworthy Ave, San Jose, CA’, 37.274647, -121.892891, ”),
(169, ‘Round Table Pizza’, ‘4302 Moorpark Ave, San Jose, CA’, 37.315903, -121.977928, ”),
(170, ‘Butcher1’, ‘Ahmedabad,382352’, 23.039568, 72.566002, ”),
(171, ‘Butcher2’, ‘Gandhinagar,382610’, 23.229391, 72.651978, ”);

Step :2 phpsqlsearch_dbinfo.php

<?
$username=”root”;
$password=””;
//$database=”test”;
$database=”test”;
?>

Step :3 phpsqlsearch_genxml.php

<?php
require(“phpsqlsearch_dbinfo.php”);

// Get parameters from URL
$center_lat = $_GET[“lat”];
$center_lng = $_GET[“lng”];
$radius = $_GET[“radius”];

// Start XML file, create parent node
$dom = new DOMDocument(“1.0”);
$node = $dom->createElement(“markers”);
$parnode = $dom->appendChild($node);

// Opens a connection to a mySQL server
$connection=mysql_connect (localhost, $username, $password);
if (!$connection) {
die(“Not connected : ” . mysql_error());
}

// Set the active mySQL database
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
die (“Can\’t use db : ” . mysql_error());
}

// Search the rows in the markers table
$query = sprintf(“SELECT address, name, lat, lng, ( 3959 * acos( cos( radians(‘%s’) ) * cos( radians( lat ) ) * cos( radians( lng ) – radians(‘%s’) ) + sin( radians(‘%s’) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < ‘%s’ ORDER BY distance LIMIT 0 , 20″,
mysql_real_escape_string($center_lat),
mysql_real_escape_string($center_lng),
mysql_real_escape_string($center_lat),
mysql_real_escape_string($radius));
$result = mysql_query($query);

/*
$query = sprintf(”
SELECT n.nid, n.title AS name,frfp.field_postcode_value,frfa.field_adres_value AS address,
frflat.field_latitude_value as lat,frflong.field_longitude_value as lng,
( 3959 * acos( cos( radians(‘%s’) ) * cos( radians( frflat.field_latitude_value ) ) * cos( radians( frflong.field_longitude_value ) – radians(‘%s’) ) + SIN( RADIANS(‘%s’) ) * SIN( RADIANS( frflat.field_latitude_value ) ) ) ) AS distance
FROM node n
LEFT JOIN field_revision_field_postcode frfp ON frfp.entity_id=n.nid
LEFT JOIN field_revision_field_adres frfa ON frfa.entity_id=n.nid
LEFT JOIN field_revision_field_latitude frflat ON frflat.entity_id=n.nid
LEFT JOIN field_revision_field_longitude frflong ON frflong.entity_id=n.nid
WHERE n.type=’current_butcher’ HAVING distance < ‘%s’ ORDER BY distance LIMIT 0 , 20″,
mysql_real_escape_string($center_lat),
mysql_real_escape_string($center_lng),
mysql_real_escape_string($center_lat),
mysql_real_escape_string($radius));

//echo $query;exit;
$result = mysql_query($query);
*/
if (!$result) {
die(“Invalid query: ” . mysql_error());
}

header(“Content-type: text/xml”);

// Iterate through the rows, adding XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
$node = $dom->createElement(“marker”);
$newnode = $parnode->appendChild($node);
$newnode->setAttribute(“name”, $row[‘name’]);
$newnode->setAttribute(“address”, $row[‘address’]);
$newnode->setAttribute(“lat”, $row[‘lat’]);
$newnode->setAttribute(“lng”, $row[‘lng’]);
$newnode->setAttribute(“distance”, $row[‘distance’]);
}

echo $dom->saveXML();
?>

Step :4 :phpsqlsearch_map.html

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”&gt;
<!–
Copyright 2008 Google Inc.
Licensed under the Apache License, Version 2.0:
http://www.apache.org/licenses/LICENSE-2.0
–>
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”content-type” content=”text/html; charset=utf-8″/>
<title>Google Maps AJAX + MySQL/PHP Example</title>
<script src=”http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjU0EJWnWPMv7oQ-jjS7dYxSPW5CJgpdgO_s4yyMovOaVh_KvvhSfpvagV18eOyDWu7VytS6Bi1CWxw&#8221;
type=”text/javascript”></script>
<script type=”text/javascript”>
//<![CDATA[
var map;
var geocoder;

function load() {
if (GBrowserIsCompatible()) {
geocoder = new GClientGeocoder();
map = new GMap2(document.getElementById(‘map’));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(40, -100), 4);
}
}

function searchLocations() {
var address = document.getElementById(‘addressInput’).value;
geocoder.getLatLng(address, function(latlng) {
if (!latlng) {
alert(address + ‘ not found’);
} else {

searchLocationsNear(latlng);
}
});
}

function searchLocationsNear(center) {
var radius = document.getElementById(‘radiusSelect’).value;
var searchUrl = ‘phpsqlsearch_genxml.php?lat=’ + center.lat() + ‘&lng=’ + center.lng() + ‘&radius=’ + radius;
GDownloadUrl(searchUrl, function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName(‘marker’);
map.clearOverlays();

var sidebar = document.getElementById(‘sidebar’);
sidebar.innerHTML = ”;
if (markers.length == 0) {
sidebar.innerHTML = ‘No results found.’;
map.setCenter(new GLatLng(40, -100), 4);
return;
}

var bounds = new GLatLngBounds();
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute(‘name’);
var address = markers[i].getAttribute(‘address’);
var distance = parseFloat(markers[i].getAttribute(‘distance’));
var point = new GLatLng(parseFloat(markers[i].getAttribute(‘lat’)),
parseFloat(markers[i].getAttribute(‘lng’)));

var marker = createMarker(point, name, address);
map.addOverlay(marker);
var sidebarEntry = createSidebarEntry(marker, name, address, distance);
sidebar.appendChild(sidebarEntry);
bounds.extend(point);
}
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
});
}

function createMarker(point, name, address) {
var marker = new GMarker(point);
var html = ‘<b>’ + name + ‘</b> <br/>’ + address;
GEvent.addListener(marker, ‘click’, function() {
marker.openInfoWindowHtml(html);
});
return marker;
}

function createSidebarEntry(marker, name, address, distance) {
var div = document.createElement(‘div’);
var html = ‘<b>’ + name + ‘</b> (‘ + distance.toFixed(1) + ‘)<br/>’ + address;
div.innerHTML = html;
div.style.cursor = ‘pointer’;
div.style.marginBottom = ‘5px’;
GEvent.addDomListener(div, ‘click’, function() {
GEvent.trigger(marker, ‘click’);
});
GEvent.addDomListener(div, ‘mouseover’, function() {
div.style.backgroundColor = ‘#eee’;
});
GEvent.addDomListener(div, ‘mouseout’, function() {
div.style.backgroundColor = ‘#fff’;
});
return div;
}
//]]>
</script>
</head>

<body onload=”load()” onunload=”GUnload()”>
Address: <input type=”text” id=”addressInput”/>
Radius:
<select id=”radiusSelect”>
<option value=”25″ selected>25</option>
<option value=”100″>100</option>
<option value=”200″>200</option>
</select>
<input type=”button” onclick=”searchLocations()” value=”Search Locations”/>
<br/>
<br/>
<div id=”sidebar” style=”overflow: auto;  font-size: 11px; color: #000″></div><br/>
<div style=”width:600px; font-family:Arial,sans-serif; font-size:11px;”>
<div id=”map” style=”overflow: hidden; width:400px; height:400px”></div>
</div>
</body>
</html>

Advertisements

Get kilometer from two pincode / zipcode in google map


<?php
/**
* GETCOORD
* Uses Google Maps to resolve the coordinates of a postal code
*
* @param   String   $postal   Postal code to lookup
* @return  Array    Returns array with latitude and longitude
* @return  Boolean  False if an error occurred
*/

// —- | REQUIRED GOOGLE MAPS KEY | ——–
// Get yours here: http://www.google.com/apis/maps/signup.html
define(‘KEY’, ‘ABQIAAAAjU0EJWnWPMv7oQ-jjS7dYxSPW5CJgpdgO_s4yyMovOaVh_KvvhSfpvagV18eOyDWu7VytS6Bi1CWxw’);

function getCoord($postal)
{
$d = file_get_contents(‘http://maps.google.com/maps/geo?q=&#8217; . $postal . ‘&output=xml&key=’ . KEY);
if (!$d)
return false; // Failed to open connection

$coord = new SimpleXMLElement($d);

if ((string) $coord->Response->Status->code != ‘200’)
return false; // Invalid status code

list($lng, $lat) = explode(‘,’, (string) $coord->Response->Placemark->Point->coordinates);

return array(‘Lat’ => (float) $lat, ‘Lng’ => (float) $lng);
}

/**
* CALCDISTANCE
* Calculates the distance between to postal codes
*
* @param   String   $postal1   Starting postal code
* @param   String   $postal2   Ending postal code
* @return  Float    Returns distance in kilometers
* @return  Boolean  False if an error occurred
*/
function calcDistance($postal1, $postal2)
{
$dst1 = getCoord($postal1);
$dst2 = getCoord($postal2);

if (!$dst1 or !$dst2)
return false; // Invalid postal codes

$kms = rad2deg(acos(sin(deg2rad($dst1[‘Lat’])) * sin(deg2rad($dst2[‘Lat’])) +
cos(deg2rad($dst1[‘Lat’])) * cos(deg2rad($dst2[‘Lat’])) *
cos(deg2rad($dst1[‘Lng’] – $dst2[‘Lng’])))) * 60 * 1.1515 * 1.609344;

return $kms;
}

echo calcDistance(‘1790’, ‘1795’) . ‘ kms’; // prints 37…. kms
?>

 

showing direction on map from two textbox and also getting alternative ways from json


file1.php

========================================================================

<!DOCTYPE html>
<html>
<head>
<meta name=”viewport” content=”initial-scale=1.0, user-scalable=no”/>
<meta http-equiv=”content-type” content=”text/html; charset=UTF-8″/>
<title>Google Maps JavaScript API v3 Example: Directions Waypoints</title>
<link href=”http://code.google.com/apis/maps/documentation/javascript/examples/standard.css&#8221; rel=”stylesheet” type=”text/css” />
<link rel=”stylesheet” type=”text/css” href=”http://carshare.vervesys.com//css/redmond/jquery-ui-1.8.1.custom.css&#8221; media=”screen” />
<link rel=”stylesheet” type=”text/css” href=”http://carshare.vervesys.com//css/coVoiturage.css&#8221; media=”screen” />
<!–AUTHOR : HARISH PATIL
DATE : 07-MARCH-2011
DESCR : GETTING DISTANCE–>

<script src=”http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAxfM792nyXR7woBqjAj9EPhRHvOZxbfYMBkr56pDT3TCnqDxE_RQyQt5acukouEbxsJtR6uKxEqImhQ&#8221; type=”text/javascript”></script>
<script type=”text/javascript” src=”http://maps.google.com/maps/api/js?sensor=false”></script&gt;
<!–AJAX–>
<script type=”text/javascript”>
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
var geocoder;
var side_bar_html = “”;
var gmarkers = [];
var htmls = [];
var i = 0;

function initialize() {

geocoder = new GClientGeocoder();
directionsDisplay = new google.maps.DirectionsRenderer();
var chicago = new google.maps.LatLng(41.850033, -87.6500523);
var myOptions = {
zoom: 3,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: chicago
}
map = new google.maps.Map(document.getElementById(“map_canvas”), myOptions);
directionsDisplay.setMap(map);

}
function stripVowelAccent(str)
{
var s=str;

var rExps=[ /[\xC0-\xC2]/g, /[\xE0-\xE2]/g,
/[\xC8-\xCA]/g, /[\xE8-\xEB]/g,
/[\xCC-\xCE]/g, /[\xEC-\xEE]/g,
/[\xD2-\xD4]/g, /[\xF2-\xF4]/g,
/[\xD9-\xDB]/g, /[\xF9-\xFB]/g ];

var repChar=[‘A’,’a’,’E’,’e’,’I’,’i’,’O’,’o’,’U’,’u’];

for(var i=0; i<rExps.length; i++)
s=s.replace(rExps[i],repChar[i]);

return s;
}
function calcRoute(start,end,waypoints,flag) {
//alert(waypoints);

var waypts = [];

if(waypoints !=null && waypoints !=”)
waypts.push({
location:waypoints,
stopover:true});

var request = {
origin: start,
destination: end,
waypoints: waypts,
optimizeWaypoints: true,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};

directionsService.route(request, function(response, status) {
if(status==google.maps.DirectionsStatus.ZERO_RESULTS)
{
alert(“Sorry, There is no result found.Please provide more specification or valid address.”);
}
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
if(flag==’0′)
{

<!–    ===================================================================================================–>
document.getElementById(‘loading’).style.display=’block’;

var url ='<?php echo config_item(‘base_url’);?>/gethint.php?address1=’+stripVowelAccent(start)+’&address2=’+stripVowelAccent(end)+’&a=’+Math.random();

var ajaxReq = getXmlHttpRequestObject();

if(ajaxReq.readyState == 4 || ajaxReq.readyState == 0)
{

ajaxReq.open(“post”, url, true);
ajaxReq.onreadystatechange = function()
{

if(ajaxReq.readyState == 4 && ajaxReq.status == 200)
{

var doc=ajaxReq.responseText;
//alert(doc);
//alert(doc);

<!–=================================XXXXXXXXXXXXXXXXXXXXXXXXXXX=====================================–>
// === Parse the JSON document ===
var jsonData = eval(‘(‘ + doc + ‘)’);
side_bar_html=””;
// === Plot the markers ===

for (var i=0; i<jsonData.routes.length;i++)
{
// var point = new GLatLng(jsonData.routes[0].legs[0].steps[i].start_location.lat, jsonData.routes[0].legs[0].steps[i].start_location.lng);
//         alert(jsonData.routes.length);
var lable=””;
var start=””;
var end=””;
var via_waypoint=””;
var via_waypoint_address=””;
var distance=””;
var times=””;

start=jsonData.routes[i].legs[0].start_address;
end=jsonData.routes[i].legs[0].end_address;
distance=jsonData.routes[i].legs[0].distance.text;
times=jsonData.routes[i].legs[0].duration.text;

if(jsonData.routes[i].legs[0].via_waypoint.length>0)
{

via_waypoint=jsonData.routes[i].legs[0].via_waypoint[0].location.lat+” “+jsonData.routes[i].legs[0].via_waypoint[0].location.lng;
point = new GLatLng(jsonData.routes[i].legs[0].via_waypoint[0].location.lat,jsonData.routes[i].legs[0].via_waypoint[0].location.lng);

side_bar_html += ‘ <input type=”radio” name=”waypoints” onclick=”selectWay(\”+start+’\’,\”+end+’\’,\”+via_waypoint+’\’,\”+distance+’\’);” value=”‘+distance+'” />Way ‘+(i+1)+’ : ‘+’ Distance (‘+distance+’) Times (‘+times+’)<br/>’;
//   side_bar_html += start+”     “+end+”     “+distance+”     “+via_waypoint+”<br>”;
}
else
{

via_waypoint=”;
//point = new GLatLng(jsonData.routes[i].legs[0].via_waypoint[0].location.lat,jsonData.routes[i].legs[0].via_waypoint[0].location.lng);

side_bar_html += ‘ <input type=”radio” name=”waypoints”  onclick=”selectWay(\”+start+’\’,\”+end+’\’,\”+via_waypoint+’\’,\”+distance+’\’);” value=”‘+distance+'” />Way ‘+(i+1)+’ : ‘+’ Distance (‘+distance+’) Times (‘+times+’)<br/>’;
//   side_bar_html += start+”     “+end+”     “+distance+”     “+via_waypoint+”<br>”;
}

}
side_bar_html=side_bar_html+'<br/><input type=”button” name=”submit” onclick=”return post_value();” value=”Submit” />’;
document.getElementById(“side_bar”).innerHTML = side_bar_html;
document.getElementById(‘loading’).style.display=’none’;
<!–================================XXXXXXXXXXXXXXXXXXXXXXXXXXXX=====================================–>

}
}
ajaxReq.send(null);
}
<!–            ===================================================================================================–>

}
}
});

}

<!–  ================================================–>

function getFirst()
{

var start = document.getElementById(“start”).value;
geocoder.getLocations(start, getSecond);
}
function getSecond(response)
{

var end = document.getElementById(“end”).value;
if (!response || response.Status.code != 200) {
alert(“Sorry, we were unable to geocode that address”);
}
else
{
place = response.Placemark[0];
if(place.AddressDetails.Country.CountryNameCode==”US” || place.AddressDetails.Country.CountryNameCode==”CA”)
{
geocoder.getLocations(end,hello);
}
else
{
alert(‘Departure is out of CANADA and USA location’);
}
}
}
function hello(response)
{

if (!response || response.Status.code != 200) {
alert(“Sorry, we were unable to geocode that address”);
}
else
{
place = response.Placemark[0];
if(place.AddressDetails.Country.CountryNameCode==”CA” || place.AddressDetails.Country.CountryNameCode==”US”)
{
var start = document.getElementById(“start”).value;
var end = document.getElementById(“end”).value;

calcRoute(start,end,”,’0′);

}
else
{
alert(‘Arrival is out of CANADA and USA location’);
}

}
}

<!–==============================================================================================================–>

// ================================================================
// === Define the function thats going to process the JSON file ===
function process_it (doc)
{

//alert(doc);

// === Parse the JSON document ===
var jsonData = eval(‘(‘ + doc + ‘)’);
side_bar_html=””;
// === Plot the markers ===

for (var i=0; i<jsonData.routes.length;i++)
{
// var point = new GLatLng(jsonData.routes[0].legs[0].steps[i].start_location.lat, jsonData.routes[0].legs[0].steps[i].start_location.lng);
//         alert(jsonData.routes.length);
var lable=””;
var start=””;
var end=””;
var via_waypoint=””;
var via_waypoint_address=””;
var distance=””;
var times=””;

start=jsonData.routes[i].legs[0].start_address;
end=jsonData.routes[i].legs[0].end_address;
distance=jsonData.routes[i].legs[0].distance.text;
times=jsonData.routes[i].legs[0].duration.text;

if(jsonData.routes[i].legs[0].via_waypoint.length>0)
{

via_waypoint=jsonData.routes[i].legs[0].via_waypoint[0].location.lat+” “+jsonData.routes[i].legs[0].via_waypoint[0].location.lng;
point = new GLatLng(jsonData.routes[i].legs[0].via_waypoint[0].location.lat,jsonData.routes[i].legs[0].via_waypoint[0].location.lng);

side_bar_html += ‘ <input type=”radio” name=”waypoints” onclick=”selectWay(\”+start+’\’,\”+end+’\’,\”+via_waypoint+’\’,\”+distance+’\’);” value=”‘+distance+'” />Way ‘+(i+1)+’ : ‘+’ Distance (‘+distance+’) Times (‘+times+’)<br/>’;
//   side_bar_html += start+”     “+end+”     “+distance+”     “+via_waypoint+”<br>”;
}
else
{

via_waypoint=”;
//point = new GLatLng(jsonData.routes[i].legs[0].via_waypoint[0].location.lat,jsonData.routes[i].legs[0].via_waypoint[0].location.lng);

side_bar_html += ‘ <input type=”radio” name=”waypoints” id=”temp_waypoints” onclick=”selectWay(\”+start+’\’,\”+end+’\’,\”+via_waypoint+’\’,\”+distance+’\’);” value=”‘+distance+'” />Way ‘+(i+1)+’ : ‘+’ Distance (‘+distance+’) Times (‘+times+’)<br/>’;
//   side_bar_html += start+”     “+end+”     “+distance+”     “+via_waypoint+”<br>”;
}

}
side_bar_html=side_bar_html+'<br/><input type=”button” onclick=”return post_value();” name=”submit” value=”Submit” />’;
document.getElementById(“side_bar”).innerHTML = side_bar_html;
document.getElementById(‘loading’).style.display=’none’;

}

function selectWay(start,end,waypoints,distance)
{
document.getElementById(“address1”).value = start;
document.getElementById(“address2″).value = end;
document.getElementById(‘waypoints’).value=waypoints;
document.getElementById(‘miledistance’).value=distance;
calcRoute(start,end,waypoints,’1′);
}

</script>
<script langauge=”javascript”>
function post_value(){
var len=document.frmvalue.waypoints.length;
var flag=false;
for(var i=0;i<len;i++){
if(document.frmvalue.waypoints[i].checked==true){
flag=true;
}
}

if(flag==false)
{
alert(‘Please select atleast one route’);
return false;
}
else
{
opener.document.formOfferTrip.miledistance.value = document.frmvalue.miledistance.value;
opener.document.formOfferTrip.departureWaypoint.value = document.frmvalue.address1.value;
opener.document.formOfferTrip.arrivalWaypoint.value = document.frmvalue.address2.value;
opener.document.formOfferTrip.waypoints.value = document.frmvalue.waypoints_1.value;
var html='<label name=”lbl2″ id=”lbl2″ style=”margin-top:-6px”>Distance : </label>’+document.frmvalue.miledistance.value;
opener.document.getElementById(‘distance_section’).style.display=’block’;
opener.document.getElementById(‘distance_section’).innerHTML = html;
self.close();
}
}
</script>
<!–AJAX–>

<script type=”text/javascript”>

function getXmlHttpRequestObject()
{
if (window.XMLHttpRequest)
{
return new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
return new ActiveXObject(“Microsoft.XMLHTTP”);
}
else
{
alert(“Please upgrade your browser. The current version does not support the booking request.”);
}
}

</script>

<!–END–>
</head>
<body style=”background-color:#63caf3;” onLoad=”initialize();”>

<div style=”background-color:#8fd9f7″>

<div id=”directions_panel” style=”margin:20px;background-color:#FFEE77;display:none;” style=”background-color:#63caf3;”></div>
<div style=”float:right”>

</div>
<table width=”100%” border=”0″>
<tr>
<td style=”width:35%;”>
<form action=”” name=”frm”>
<table align=”center” border=”none” style=”border:0″>
<tr>
<td><label for=”departureCity”>Departure</label></td>
<td><input type=”text” name=”address1″ id=”start” value=”” /></td>
</tr>
<tr>
<td><label for=”departureCity”>Arrival</label></td>
<td><input type=”text” name=”address2″ id=”end” value=””  /></td>
</tr>
<tr>
<td colspan=”2″ align=”center”><input type=”hidden” name=”oper” value=”search” />
<button type=”button” onClick=”getFirst();” value=”button” style=”color:#FFFFFF;height:20px;” >&nbsp;Search</button>
</td>
</tr>
</table>
</form>
</td>
<td>
<form name=”frmvalue” action=”<?php echo config_item(‘base_url’);?>/index.php/trip/displayOffer” method=”post”>
<div id=”side_bar”></div>
<input type=”hidden” name=”miledistance” id=”miledistance” value=”” />
<input type=”hidden” name=”address1″ id=”address1″ value=”” />
<input type=”hidden” name=”address2″ id=”address2″ value=””  />
<input type=”hidden” name=”waypoints_1″ id=”waypoints” value=””  />

</form>
<div id=”loading”  style=” text-align:center;border:none;z-index:1;display:none;”>
<img src=”http://carshare.vervesys.com/ajax-loader_new.gif&#8221; style=”border:none;”>
</div>

</td>
</tr>
<tr>
<td colspan=”2″ style=”width:100%;height:500px;” ><div id=”map_canvas” style=”float:left;width:100%;height:500px;”></div> </td>
</tr>
</table>
<input type=”hidden” name=”filename” id=”filename” value=””/>
</div>

</body>
</html>
================================================================================

gethint.php

=================================================================================
<?php

$address1=trim($_REQUEST[“address1”]);
$address2=trim($_REQUEST[“address2″]);

$Url=”http://maps.googleapis.com/maps/api/directions/json?origin=&#8221;.$address1.”&destination=”.$address2.”&sensor=false&alternatives=true”;//exit;
$Url=str_replace(” “,”%20″,$Url);
//http://maps.googleapis.com/maps/api/directions/json?origin=Seneca Planetarium Seneca College, 1750 Finch Ave E, Toronto, Toronto Division, Ontario M2J 5G3, Canada&destination=ny,us&sensor=false&alternatives=true
// create a new curl resource

//    $Url=”http://maps.googleapis.com/maps/api/directions/json?origin=Seneca%20Planetarium%20Seneca%20College,%201750%20Finch%20Ave%20E,%20Toronto,%20Toronto%20Division,%20Ontario%20M2J%205G3,%20Canada&destination=ny,us&sensor=false&alternatives=true&#8221;;

$ch = curl_init();
// set URL to download
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt ($ch, CURLOPT_POST, 1);
// set referer:

// user agent:
//curl_setopt($ch, CURLOPT_USERAGENT, “MozillaXYZ/1.0”);

// remove header? 0 = yes, 1 = no
curl_setopt($ch, CURLOPT_HEADER, 0);

// should curl return or print the data? true = return, false = print
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// timeout in seconds
//    curl_setopt($ch, CURLOPT_TIMEOUT, 1000);

// download the given URL, and return output
$output = curl_exec($ch);
/*$filename = “json/”.time().”.json”;

$handle = fopen($filename, ‘w+’);
chmod($handle,’777′);
if($handle)
{

if(!fwrite($handle, $output))
die(“couldn’t write to file.”);

}*/

curl_close($ch);
//echo $filename;

echo $output;
//echo $output;

?>

Read JSON file for google map information


var jsonData = eval(‘(‘ + doc + ‘)’);
side_bar_html=””;

for (var i=0; i<jsonData.routes.length;i++)
{

var lable=””;
var start=””;
var end=””;
var via_waypoint=””;
var via_waypoint_address=””;
var distance=””;
var times=””;

start=jsonData.routes[i].legs[0].start_address;
end=jsonData.routes[i].legs[0].end_address;
distance=jsonData.routes[i].legs[0].distance.text;
times=jsonData.routes[i].legs[0].duration.text;

if(jsonData.routes[i].legs[0].via_waypoint.length>0)
{

via_waypoint=jsonData.routes[i].legs[0].via_waypoint[0].location.lat+” “+jsonData.routes[i].legs[0].via_waypoint[0].location.lng;
point = new GLatLng(jsonData.routes[i].legs[0].via_waypoint[0].location.lat,jsonData.routes[i].legs[0].via_waypoint[0].location.lng);

side_bar_html += ‘ <input type=”radio” name=”waypoints” onclick=”selectWay(\”+start+’\’,\”+end+’\’,\”+via_waypoint+’\’,\”+distance+’\’);” value=”‘+distance+'” />Way ‘+(i+1)+’ : ‘+’ Distance (‘+distance+’) Times (‘+times+’)<br/>’;
}
else
{

via_waypoint=”;
side_bar_html += ‘ <input type=”radio” name=”waypoints” onclick=”selectWay(\”+start+’\’,\”+end+’\’,\”+via_waypoint+’\’,\”+distance+’\’);” value=”‘+distance+'” />Way ‘+(i+1)+’ : ‘+’ Distance (‘+distance+’) Times (‘+times+’)<br/>’;

}

}

Get Distance of two points in google map


<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”content-type” content=”text/html; charset=UTF-8″/>
<title>Calculate distance with Google Maps API</title>
<script src=”http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA7j_Q-rshuWkc8HyFI4V2HxQYPm-xtd00hTQOC0OXpAMO40FHAxT29dNBGfxqMPq5zwdeiDSHEPL89A&#8221; type=”text/javascript”></script>
<!– According to the Google Maps API Terms of Service you are required display a Google map when using the Google Maps API. see: http://code.google.com/apis/maps/terms.html –>
<script type=”text/javascript”>

var geocoder, location1, location2;

function initialize() {
geocoder = new GClientGeocoder();
}

function showLocation() {
geocoder.getLocations(document.forms[0].address1.value, function (response) {
if (!response || response.Status.code != 200)
{
alert(“Sorry, we were unable to geocode the first address”);
}
else
{
location1 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
geocoder.getLocations(document.forms[0].address2.value, function (response) {
if (!response || response.Status.code != 200)
{
alert(“Sorry, we were unable to geocode the second address”);
}
else
{
location2 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
calculateDistance();
}
});
}
});
}

function calculateDistance()
{
try
{
var glatlng1 = new GLatLng(location1.lat, location1.lon);
var glatlng2 = new GLatLng(location2.lat, location2.lon);
var miledistance = glatlng1.distanceFrom(glatlng2, 3959).toFixed(1);
var kmdistance = (miledistance * 1.609344).toFixed(1);
document.getElementById(‘results’).innerHTML = ‘<strong>Address 1: </strong>’ + location1.address + ‘ (‘ + location1.lat + ‘:’ + location1.lon + ‘)<br /><strong>Address 2: </strong>’ + location2.address + ‘ (‘ + location2.lat + ‘:’ + location2.lon + ‘)<br /><strong>Distance: </strong>’ + miledistance + ‘ miles (or ‘ + kmdistance + ‘ kilometers)’;
}
catch (error)
{
alert(error);
}
}

</script>
</head>

<body onload=”initialize()”>

<form action=”#” onsubmit=”showLocation(); return false;”>
<p>
<input type=”text” name=”address1″ value=”Address 1″ size=”40″ />
<input type=”text” name=”address2″ value=”Address 2″ size=”40″ />
<input type=”submit” name=”find” value=”Search” />
</p>
</form>
<p id=”results”></p>

</body>
</html>

google translate by javascript


Hi Friend…

this is a google translate script which translate whole website contents in target language.

please copy and paste this content as demo .

 

 

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>

<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
</head>

<body>
<div id=”google_translate_element”></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: ‘en’
}, ‘google_translate_element’);
}
</script><script src=”//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit”></script>
This is test demo which has been developed by me.

</body>
</html>