/** * Get lat lon by address * @author Oleg D. */ function getLatLon($address, $updateAddress = 0) { $addressString = $city = $state = $country = ''; if (!empty($address['address'])) { $addressString = $address['address'] . ' ' . $address['address2'] . ' ' . $address['address3']; if (!empty($address['city'])) { $city = $address['city']; } if (!empty($address['Country']['name'])) { $country = $address['Country']['name']; } elseif (!empty($address['country_name'])) { $country = $address['country_name']; } if (!empty($address['Provincestate']['name'])) { $state = $address['Provincestate']['name']; } elseif (!empty($address['state_name'])) { $state = $address['state_name']; } App::import('Vendor', 'GoogleMapAPI', array('file' => 'class.GoogleMapAPI.php')); $map = new GoogleMapAPI(); $map->setAPIKey(GOOGLE_MAP_KEY); $latLon = $map->getCoordsByAddress(trim($addressString), $city, $state, $country); if ($updateAddress && !empty($address['id']) && !empty($latLon['lat']) && !empty($latLon['lon'])) { $Address = new Address(); $Address->save(array('id' => $address['id'], 'latitude' => $latLon['lat'], 'longitude' => $latLon['lon'])); } return $latLon; } else { return false; } }
/** * Get lat lon by address * * modified by skinny....$state can be array('id'=>$id) and $country can be array('id'=>$id) * * @author Oleg D. */ function getLatLon($address = null, $city = null, $state = null, $country = null) { if (is_array($state)) { $stateid = $state['id']; $provinceState = $this->Provincestate->find('first', array('id' => $stateid)); $state = $provinceState['Provincestate']['name']; } if (is_array($country)) { $countryid = $country['id']; $country = $this->Country->find('first', array('id' => $countryid)); $country = $country['Country']['name']; } App::import('Vendor', 'GoogleMapAPI', array('file' => 'class.GoogleMapAPI.php')); $map = new GoogleMapAPI(); $map->setAPIKey(GOOGLE_MAP_KEY); return $map->getCoordsByAddress($address, $city, $state, $country); }
require_once 'IndirectBusStructureWithFrequency.php'; require_once 'KLogger.php'; require_once 'DisplayJunctionsDataV2.php'; require_once 'DisplaySortedJunctionData.php'; //require('GoogleApiAdvancedClass.php'); //require('JSMin.php'); set_time_limit(60); //$DEBUG=false; $map = new GoogleMapAPI('map'); // setup database for geocode caching // $map->setDSN('mysql://*****:*****@localhost/GEOCODES'); // enter YOUR Google Map Key //$map->setAPIKey('ABQIAAAA1c1sWAqiVfYVo2H2uZO3DRSWrvxHdeTKbGAggAmAoqEyMU0eFRSTrS7LnHnkyvA93YPmiuF_C-0r7Q'); // this is registered for mygann.com // new key ABQIAAAA1c1sWAqiVfYVo2H2uZO3DRSdbZxIVjTSMKDiD-iCCeLYxJJn_BTfNn4DtNyckPujCTOcXysH3Glq9g $map->setAPIKey('ABQIAAAA1c1sWAqiVfYVo2H2uZO3DRSdbZxIVjTSMKDiD-iCCeLYxJJn_BTfNn4DtNyckPujCTOcXysH3Glq9g'); $log = new KLogger("log.txt", KLogger::DEBUG); // connect to the database $db_server = mysql_connect($db_hostname, $db_username, $db_password); if (!$db_server) { die("Unable to connect to MYSQL: " . mysql_error()); } mysql_select_db($db_database) or die("Unable to select database: " . mysql_error()); //$DEBUG=true; // increase the time out to infinity default is 60 set_time_limit(0); /** * distance(): this function will calcualte the distance between the two points given the latitude and the longitude of the 2 points * the distance is bas4ed on the straight line and is not the driving distance **/ function distance($lat1, $lon1, $lat2, $lon2, $unit)
<?php // Load Elgg engine include_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; echo '<link href="views/default/css.php" rel="stylesheet" type="text/css" />'; //////////////////////////////////////////////////////////// //////////////////////////map////////////////////////////// /////////////////////////////////////////////////////////// require_once 'GoogleMapAPI-2.5/GoogleMapAPI.class.php'; $map = new GoogleMapAPI('map'); // setup database for geocode caching $map->setDSN('mysql://elgg@localhost:81/elgg'); // enter YOUR Google Map Key $map->setAPIKey('ABQIAAAAQNUInQTwgn5VDDyl8bOByxTn2aORatyZyU46qAvXBfOijvU79hSczO6cDTdYULHuwTIH54k9rc-_Ng'); // create some map markers //$map->addMarkerByAddress("Kozani","Stathis","<b>Stathis</b><a href=\"http://metamorphosis.med.duth.gr/pg/profile/stathis\">Stathis Konstantinidis</a>","" ); //$map->addMarkerByAddress("GR","Nikolas","<b>Nikolas</b>","" ); //$map->addMarkerByAddress("Mallorca","S","<b>S</b>","" ); //$map->addMarkerByAddress("Stuttgardt","Germany","<b>Germany</b>","" ); ///// Show repurposed objects for content_item (<-content item id) $selected_c_i = $_GET['content_item']; /* * show_history_on_map($selected_c_i, $map); -> Gia na deiksei ta repurposed antikeimena * Gia na treksei http://metamorphosis.med.duth.gr/mod/content_item/show_map_content_item.php?content_item=1220 * * show_all_repurposed_content_items_on_map($map); -> Gia na deiksei ola ta repurposed content items. * */ //////////// //show_history_on_map($selected_c_i, $map); //show_all_repurposed_content_items_on_map($map);
<!--<?php require_once 'header_php.php'; ?> --> <?php $map = new GoogleMapAPI('map'); $map->setAPIKey($googlemaps_key); $map->disableSidebar(); $map->setMapType('map'); $map->setWidth(510); $map->setHeight(350); $map->setMapType('hybrid'); $map->disableDirections(); $map->setZoomLevel(13); //$map->addMarkerByAddress('5186-F Longs Peak Road Berthoud Colorado 80513','','Colorado Water Jet<br>5186-F Longs Peak Road<br>Berthoud, Colorado 80513'); $map->addMarkerByCoords(-104.98301267623901, 40.34088546651259, '', 'Colorado Water Jet<br>5186 Longs Peak Road Unit F<br>Berthoud, Colorado 80513'); ?> <?php include 'header.php'; ?> <table align="center" border="0" cellpadding="0" cellspacing="0"> <tr valign='top'><td rowspan='3'>Colorado WaterJet<br>5186 Longs Peak Road Unit F<br>Berthoud, Colorado 80513</td><td rowspan='3'><img src="/images/clear.gif" height="1" width="60"></td> <td>970-532-5404</td></tr> <tr><td><a href="mailto:sales@coloradowaterjet.com">sales@coloradowaterjet.com</a></td></tr>
require_once 'loginMySQL.php'; require('GoogleMapAPI.class.php'); require_once('BusDataStructure.php'); require_once('IndirectBusStructure.php'); require_once 'KLogger.php'; require_once 'DisplayJunctionsData.php'; //require('GoogleApiAdvancedClass.php'); //require('JSMin.php'); $map = new GoogleMapAPI('map'); // setup database for geocode caching // $map->setDSN('mysql://*****:*****@localhost/GEOCODES'); // enter YOUR Google Map Key //$map->setAPIKey('ABQIAAAA1c1sWAqiVfYVo2H2uZO3DRSWrvxHdeTKbGAggAmAoqEyMU0eFRSTrS7LnHnkyvA93YPmiuF_C-0r7Q'); // this is registered for mygann.com $map->setAPIKey('ABQIAAAA1c1sWAqiVfYVo2H2uZO3DRQ-Owys87H0UMOnk1A622ubszpz9RQGCAfKKCtR4nC1ERddua80KFlgrA'); $log = new KLogger ( "log.txt" , KLogger::DEBUG ); // connect to the database $db_server = mysql_connect($db_hostname, $db_username, $db_password); if (!$db_server) die("Unable to connect to MYSQL: " . mysql_error()); mysql_select_db($db_database) or die("Unable to select database: " . mysql_error()); // increase the time out to infinity default is 60 set_time_limit(0); /**
function nbpl_nights() { $zip = ''; $geocode = array(); if (!empty($_REQUEST['zip'])) { $zip = trim($_REQUEST['zip']); } $ObjVenueView = ClassRegistry::init("VenueView"); $conditions = array('VenueView.is_deleted' => 0, 'VenueView.nbpltype <> ' => 'None'); $order = array('VenueView.id' => 'DESC'); $fields = array('*'); if (!empty($zip)) { App::import('Vendor', 'GoogleMapAPI', array('file' => 'class.GoogleMapAPI.php')); $map = new GoogleMapAPI(); $map->setAPIKey(GOOGLE_MAP_KEY); $geocode = $map->geoGetCoords('UNITED STATES ' . $zip); if (!empty($geocode['lat']) && !empty($geocode['lon'])) { $fields[] = "(((acos(sin((" . $geocode['lat'] . " * pi()/180)) * sin((latitude*pi()/180)) + cos((" . $geocode['lat'] . " *pi()/180)) * cos((latitude * pi()/180)) \n\t\t\t\t* cos(((" . $geocode['lon'] . "- longitude)*pi()/180)))) * 180/pi()) * 60 *1.1515) as distance"; $order = array('distance' => 'ASC') + $order; } else { $zip = ''; $this->Session->setFlash('Incorrect Zip Code', 'flash_error'); } } $venues = $ObjVenueView->find('all', array('fields' => $fields, 'contain' => array('Nbplday'), 'conditions' => $conditions, 'order' => $order)); $this->set(compact('venues', 'zip', 'geocode')); }
* 2006-07 Ed Davis * * * Copyright Contributors * * ChurchInfo is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This file best viewed in a text editor with tabs stops set to 4 characters * ******************************************************************************/ require 'GoogleMapAPI/GoogleMapAPI.class.php'; $googleMapObj = new GoogleMapAPI('map'); $googleMapObj->setAPIKey($sGoogleMapKey); $bHaveXML = FALSE; if ($sXML_RPC_PATH) { $pathArray = explode(PATH_SEPARATOR, get_include_path()); foreach ($pathArray as $onePath) { $fullpath = $onePath . DIRECTORY_SEPARATOR . $sXML_RPC_PATH; if (file_exists($fullpath) && is_readable($fullpath)) { require_once "{$sXML_RPC_PATH}"; $bHaveXML = TRUE; } } if ($bHaveXML == 0) { // Maybe the user entered absolute path, let's check if (file_exists($sXML_RPC_PATH) && is_readable($sXML_RPC_PATH)) { require_once "{$sXML_RPC_PATH}"; $bHaveXML = TRUE;
<?php // Load Elgg engine include_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; echo '<link href="views/default/css.php" rel="stylesheet" type="text/css" />'; //////////////////////////////////////////////////////////// //////////////////////////map////////////////////////////// /////////////////////////////////////////////////////////// require_once 'GoogleMapAPI-2.5/GoogleMapAPI.class.php'; $map = new GoogleMapAPI('map'); // setup database for geocode caching $map->setDSN('mysql://elgg@localhost/'); // enter YOUR Google Map Key $map->setAPIKey('ABQIAAAAQNUInQTwgn5VDDyl8bOByxSM5HRgLZx_FTvWflhOcXW1FpA9rhSc6ancYc0NEjrJi8yIkmEMFXzv5Q'); // create some map markers //$map->addMarkerByAddress("Kozani","Stathis","<b>Stathis</b><a href=\"http://metamorphosis.med.duth.gr/pg/profile/stathis\">Stathis Konstantinidis</a>","" ); //$map->addMarkerByAddress("GR","Nikolas","<b>Nikolas</b>","" ); //$map->addMarkerByAddress("Mallorca","S","<b>S</b>","" ); //$map->addMarkerByAddress("Stuttgardt","Germany","<b>Germany</b>","" ); ///// Show repurposed objects for content_item (<-content item id) $selected_c_i = $_GET['content_item']; /* * show_history_on_map($selected_c_i, $map); -> Gia na deiksei ta repurposed antikeimena * Gia na treksei http://metamorphosis.med.duth.gr/mod/content_item/show_map_content_item.php?content_item=1220 * * show_all_repurposed_content_items_on_map($map); -> Gia na deiksei ola ta repurposed content items. * */ //////////// //show_history_on_map($selected_c_i, $map); show_all_repurposed_content_items_on_map($map);