function editAddress($handler, $addressId, $line1, $line2, $city, $state, $zip, $box) { $addressInfo = getAddressInfo($handler, $addressId); if ($addressInfo['addressLine1'] != $line1 || $addressInfo['addressLine2'] != $line2 || $addressInfo['addressCity'] != $city || $addressInfo['addressState'] != $state || $addressInfo['addressZip'] != $zip || $addressInfo['addressPOBox'] != $box) { $line1 = mysql_real_escape_string($line1); $line2 = mysql_real_escape_string($line2); $city = mysql_real_escape_string($city); $state = mysql_real_escape_string($state); $zip = mysql_real_escape_string($zip); $box = mysql_real_escape_string($box); $coordinates = getCoordinates("{$line1} {$zip} {$city} {$state}"); $queryAddress = "\n\t\t\tUPDATE address SET\n\t\t\t\taddressLine1 = '{$line1}',\n\t\t\t\taddressLine2 = '{$line2}',\n\t\t\t\taddressCity = '{$city}',\n\t\t\t\taddressState = '{$state}',\n\t\t\t\taddressZip = '{$zip}',\n\t\t\t\taddressPOBox = '{$box}',\n\t\t\t\taddressLat = '" . $coordinates[0] . "',\n\t\t\t\taddressLong = '" . $coordinates[1] . "'\n\t\t\tWHERE addressId = '{$addressId}'\n\t\t"; mysql_query($queryAddress, $handler); } }
function map_piner_function() { $location = array("Davao", "Panabo", "Tagum"); $areadescription = array("Hello Davao Desc", "Hello Panabo Desc", "Hello Davao Desc"); $i = 0; foreach ($location as $loc) { $coordinates = getCoordinates($loc); $lat = $coordinates["lat"]; $lng = $coordinates["lng"]; $infoHTML = '<a href="#' . $loc . '">' . $loc . '</a><p>' . $areadescription[$i] . '</p>'; ?> <script type="text/javascript"> arrLat[<?php echo $i; ?> ] = '<?php echo $lat; ?> '; arrLng[<?php echo $i; ?> ] = '<?php echo $lng; ?> '; infoLocationHTML[<?php echo $i; ?> ] = '<?php echo $infoHTML; ?> '; </script> <?php $i++; } }
function getCoordinatesSchool($record) { if (preg_match('/.*_.*/', $record['name'])) { return array(0, 0, "Dummy data"); } $address = $record['name'] . "," . $record['address'] . "," . $record['zipcode'] . "," . $record['city'] . "," . $record['country']; list($lat, $lng, $msg) = getCoordinates($address); if (preg_match('/.*No Map Results.*/', $msg)) { $address = $record['city'] . "," . $record['country']; list($lat, $lng, $msg) = getCoordinates($address); if ($msg == "") { $msg = "Approximated address"; $lat += rand(-1000, 1000) / (1000 * 1000); $lng += rand(-1000, 1000) / (1000 * 1000); } } else { if ($msg == "") { $lat += rand(-1000, 1000) / (1000 * 1000 * 3); $lng += rand(-1000, 1000) / (1000 * 1000 * 3); } } return array($lat, $lng, $msg); }
function getDistance($c1, $c2) { return distance(getCoordinates($c1), getCoordinates($c2)); }
//Remove Stop Words foreach ($aggregatedResults as $key => &$value) { $value[5] = prepareSnippet($value[2]); } //Stem the results //$stem = PorterStemmer::Stem($value); foreach ($aggregatedResults as $key => &$value) { $tempArray = explode(" ", $value[5]); foreach ($tempArray as &$tempValue) { $tempValue = PorterStemmer::Stem($tempValue); } $value[5] = implode(" ", $tempArray); } //Get Coordinates $wordCollection = array(); getCoordinates($aggregatedResults, $wordCollection); //Cluster the results $cluster1 = array(); $cluster2 = array(); $cluster3 = array(); $cluster4 = array(); fillClusters($aggregatedResults, $cluster1, $cluster2, $cluster3, $cluster4); //********************************************************************* //EXPERIMENTAL ATTEMPT AT NAMING CLUSTERS //Remove Stop Words from clusters foreach ($cluster1 as $key => &$value) { $value[5] = prepareSnippet($value[2]); } foreach ($cluster2 as $key => &$value) { $value[5] = prepareSnippet($value[2]); }
<?php include "../commons.php"; ini_set('display_errors', 'Off'); ini_set('display_startup_errors', 'Off'); error_reporting(0); session_start(); $coordinates = getCoordinates("{$_REQUEST['addressLine1']} {$_REQUEST['addressZip']} {$_REQUEST['addressCity']} {$_REQUEST['addressState']}"); $queryAddress = "\r\nUPDATE\r\n\taddress \r\nSET\r\n\t\taddressLine1='" . mysql_real_escape_string($_REQUEST['addressLine1']) . "',\r\n\t\taddressLine2='" . mysql_real_escape_string($_REQUEST['addressLine2']) . "',\r\n\t\taddressCity='" . mysql_real_escape_string($_REQUEST['addressCity']) . "',\r\n\t\taddressState='" . mysql_real_escape_string($_REQUEST['addressState']) . "',\r\n\t\taddressZip='" . mysql_real_escape_string($_REQUEST['addressZip']) . "',\r\n\t\taddressPOBox='" . mysql_real_escape_string($_REQUEST['addressPOBox']) . "',\r\n\t\taddressLat='" . $coordinates[0] . "',\r\n\t\taddressLong='" . $coordinates[1] . "'\r\nWHERE\r\n\t\taddressId=" . $_REQUEST['a'] . "\r\n\t\t"; //p_array($_REQUEST); mysql_query($queryAddress, $conexion); //p_array($_SESSION); $queryVendor = "\r\nUPDATE\r\n\tvendor\r\nSET\r\n\t\tvendorName='" . mysql_real_escape_string($_REQUEST['vendorName']) . "',\r\n\t\tvendorInfo='" . mysql_real_escape_string($_REQUEST['vendorInfo']) . "',\r\n\t\tvendorTel='" . mysql_real_escape_string(cleanPhoneNumber($_REQUEST['vendorTel'])) . "',\r\n\t\tvendorFax='" . mysql_real_escape_string(cleanPhoneNumber($_REQUEST['vendorFax'])) . "',\r\n\t\tvendorComment ='" . mysql_real_escape_string($_REQUEST['vendorComment']) . "'\r\nWHERE\r\n\t\tvendorId=" . $_REQUEST['i'] . "\r\n\t\t"; //echo $queryVendor; mysql_query($queryVendor, $conexion); $queryLog = "\r\ninsert into \r\n\tlog\r\n\t\t(logDate, userId, logAction, logDescription)\r\n\tvalues\r\n\t\t(NOW()," . $_SESSION['user']->id . ",2,' " . mysql_real_escape_string($_REQUEST['vendorName']) . " into vendors');"; /* For Log Actions: 1 -> New (insert into) 2 -> Edit (update from) 3 -> Delete (delete from) */ mysql_query($queryLog, $conexion); mysql_close($conexion); header("Location:/trucking/php/view/viewVendor.php?i=" . $_REQUEST['i']);
<!doctype html> <html lang="es"> <head> <meta charset="UTF-8"> <style type="text/css"> #mapa { height: 500px; } </style> <script src="http://code.jquery.com/jquery-2.0.3.min.js"></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> <?php $puntos = getCoordinates($mysqli); ?> //llamamos a la funcion que me devuelve el array donde estan las fotos var listadoPuntos = <?php echo $puntos; ?> ; //console.log(listadoPuntos[1]); function initialize() {
// 2014-09-12 Created ^CS // Center Map on Address of Company function getCoordinates($address) { // Replace the whitespace with "+" sign to match with Google. ^CS $address = str_replace(" ", "+", $address); $url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address={$address}"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $results = curl_exec($ch); $data = json_decode($results, TRUE); curl_close($ch); return $data['results'][0]['geometry']['location']['lat'] . " " . $data['results'][0]['geometry']['location']['lng']; } $centerAddress = GPSMaps::GetAddress($_SESSION['customerId']); $storage = getCoordinates($centerAddress); $coordinates = explode(" ", $storage); $MyLat = $coordinates[0]; $MyLng = $coordinates[1]; // Hardcoded Data, use dropdowns in implementation to get actual truck # and GPS ID // Upon Select Date, pick start and end times for the route, 24 hour period by default $GPSID = isset($_REQUEST['TruckID']) ? $_REQUEST['TruckID'] : -1; if ($GPSID != -1) { $TruckDriver = GPSMaps::GetTruckDriver($GPSID); } else { $TruckDriver = -1; } $StartDate = isset($_REQUEST['Day']) ? $_REQUEST['Day'] : date('Y-m-d'); $FinishDate = isset($_REQUEST['Day']) ? $_REQUEST['Day'] : date('Y-m-d'); if ($StartDate == '') { $StartDate = $_POST['Day'];
<?php /** * @author James Haney * @copyright 1/2016 */ function getCoordinates($address) { $address = urlencode($address); $url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=" . $address; $response = file_get_contents($url); $json = json_decode($response, true); $lat = $json['results'][0]['geometry']['location']['lat']; $lng = $json['results'][0]['geometry']['location']['lng']; return array($lat, $lng); } $coords = getCoordinates("ottsville, pennsylvania"); print_r($coords); ?> <script type="text/javascript"> if (navigator.geolocation) { document.write("Hello World!"); } </script>
<?php require_once 'scripts/php/getxml.php'; //USE HTTP NOT HTTPS!!!!!!!!!!!!! $alertraw = $_GET['alert']; $alertID = substr($alertraw, 46); //$alert = "http://alerts.weather.gov/cap/wwacapget.php?x=AL1253B4A3478C.SevereThunderstormWarning.1253B4A3608CAL.BMXSVSBMX.46618850bf2a2ce3e3083951a2a37391"; $alert = "http://alerts.weather.gov/cap/wwacapget.php?x=" . $alertID; $coordinates = getCoordinates($alert); $county = getArea($alert); //$center = centerMap($county); ?> <!DOCTYPE html> <html> <head> <title>Area Plot</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <style> html, body, #map-canvas { height: 100%; margin: 0; padding: 0; } </style> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
$slang = $row->slang; $tlang = $row->tlang; if ($slang == $tlang || !(in_array($slang, $url_langs) && in_array($tlang, $url_langs))) { continue; } $sc = $row->scntry; $tc = $row->tcntry; if ($sc == $tc) { continue; } if (!array_key_exists($sc, $cmap)) { $cmap[$sc] = getCoordinates($sc); echo $sc; } if (!array_key_exists($tc, $cmap)) { $cmap[$tc] = getCoordinates($tc); echo $tc; } if (!array_key_exists($sc . $tc, $lmap)) { $lmap[$sc . $tc] = 1; } else { ++$lmap[$sc . $tc]; } $links[] = array($cmap[$sc], $cmap[$tc], hashColor($slang), hashColor($tlang), $sc . $tc); } // Beautify the distribution by appliying a logarithm : ) /*foreach($lmap as &$elem) { $elem = round(log($elem)*1000)/1000; }*/ for ($i = 0; $i < count($links); ++$i) { $links[$i][4] = $lmap[$links[$i][4]];
} } } } //if plan route button was clicked, direct the user to the map page and generate their route. if (isset($_POST['plan']) && isset($_POST['dayOfWeek'])) { if (isset($_POST['scheduledClients'])) { $scheduledClients = $_POST['scheduledClients']; $dayOfWeek = $_POST['dayOfWeek']; //we initialize $coordinateArray with the coordinates of the meal pick-up point $coordinateArray = array("26.701864,-80.051957"); //the route array will contain the shortest calculated route. $route = array(); //Associate ClientIDs with coordinates for ($i = 0; $i < count($scheduledClients); $i++) { array_push($coordinateArray, getCoordinates($scheduledClients[$i])); } //$coordinateArray now contains a list of coordinates fit to submit to the calculateDistance() function //we can now generate a waypoint list $numWaypoints = count($coordinateArray + 1); //we add +1 because we have to include meal pick-up point. for ($i = 0; $i < $numWaypoints; $i++) { $closestLocation = $coordinateArray[$i]; for ($j = $i + 1; $j < $numWaypoints; $j++) { $shortestDistance = 0; $distance = calculateDistance($coordinateArray[$i], $coordinateArray[$j]); if ($distance < $shortestDistance) { $shortestDistance = $distance; $closestLocation = $coordinateArray[$j]; } //shortest distance conditional
<!-- Form default layout --> <form class="panel panel-default" method="post" action="#"> <?php function getCoordinates($address) { $address = urlencode($address); $url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=" . $address; //echo $url; $response = file_get_contents($url); $json = json_decode($response, true); $lat = $json['results'][0]['geometry']['location']['lat']; $lng = $json['results'][0]['geometry']['location']['lng']; return array($lat, $lng); } if (isset($_POST['submit'])) { $coords = getCoordinates($_POST['mad']); //print_r($coords); $lat = $coords[0]; $lng = $coords[1]; $to = $_POST['to_id']; $from = $_SESSION['mobile']; $message = $_POST['message']; $loc = $lat . ', ' . $lng; include "db.php"; if ($loc == ', ' || ($lat = '')) { echo "Error occurred while decoding your Reguired GPS KEY... !!<br/> Please Try Again .. !<a href='NewMessage.php'>Click here to Try Again </a>"; } else { //date_default_timezone_set('UTC+5:30'); $date = date("Y-m-d H:i:s"); $sql = "INSERT into message values('0','{$from}','{$to}','{$loc}','RSA','{$message}','{$date}')"; $c = $mysqli->query($sql);
<kml xmlns="http://earth.google.com/kml/2.0"> <Document> <? include ('../lib/functions.php'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); $mySessionID = $_GET['mySessionID']; //Generate a marker at Latitude: 32, Longitude: -110, called Demo, with description: This is a demo # generateMarker($arrayVar[0], "Voxeo Data Center",getCoordinates(strtolower($arrayVar[0]))); generateMarker(getLocation($mySessionID), "Voxeo Data Center",getCoordinates(getLocation($mySessionID))); //Below is code for an overlay, and under that is the function that generates the Placemark ?> <ScreenOverlay> <description><![CDATA[ <a href="http://kaaosa.com">Kaaosa.com</a> is back! ]]></description> <name>Voxeo.com</name> <Icon> <href>http://demos.voxeo.com/roundTheWorld/img/voxeo.gif</href> </Icon> <visibility>1</visibility> <refreshInterval>2</refreshInterval> <viewRefreshMode>onInterval</viewRefreshMode> <viewRefreshTime>2</viewRefreshTime> <overlayXY x="0" y="1" xunits="fraction" yunits="fraction"/> <screenXY x="0" y="1" xunits="fraction" yunits="fraction"/> </ScreenOverlay> </Document>
$locations = array("Davao", "Panabo", "Tagum"); foreach ($locations as $loc) { $coordinates = getCoordinates($loc); $lat[] = $coordinates['lat']; $lng[] = $coordinates['lng']; } echo json_encode($var); break; case 'b': $locations = array("Cotabato", "Kidapawan", "Digos"); foreach ($locations as $loc) { $coordinates = getCoordinates($loc); $lat[] = $coordinates['lat']; $lng[] = $coordinates['lng']; } $var = array('locations' => $locations, 'lat' => $lat, 'lng' => $lng); echo json_encode($var); break; case 'c': $locations = array("Cebu", "Leyte", "Bohol"); foreach ($locations as $loc) { $coordinates = getCoordinates($loc); $lat[] = $coordinates['lat']; $lng[] = $coordinates['lng']; } $var = array('locations' => $locations, 'lat' => $lat, 'lng' => $lng); echo json_encode($var); break; default: break; }