NEWS: Perphenazine C.o.d. Phentermine Naproxen Ansaid! Pill price viagra Phentermine 37.5&90 $89 mastercard Viagra cialis levitra Phentermine 37.5 no perscription. Relafen Hydrocodone side effects vicodin Nabumetone Fluconazole Generic viagra cialis levivia buy cheap Phentermine and methamphetamine Fluoxetine Discount xanax Mylan xanax Buy cheap phentermine cod, Cyclamate Dextromethorphan Chlorpropamide Minocycline Woman taking viagra Bupropion, Meridia vs. Phentermine Liqued viagra Viagra cialis levitra comparison dosages Paroxetine Phentermine online without a prescription Ambien cr Sell viagra online Phentermine 30mg cap. Iproniazid Xanax lethal dose, Cheap viagra india Norflex Chlorambucil Drug phentermine 37.5 pdr Cardizem Hydrocodone query Female sexual inhancer viagra spray Cheap tramadol cod Antazoline Buy cheap phentermine online, Cialis dysfunction erectile levitra viagra Buy viagra online get prescription: Link buy online viagra info domain Free phentermine sample Phentermine studies Foradil Hydrocodone effects Ambien and pregnancy Cocaine Phentermine $70 no prescription Abacavir Aricept? Xanax prescription online Calan Cialis online Anxiety disorder xanax xr to wean off effexor xr Viagra versus levivia Metformin. Alprazolam xanax Home made viagra Trandolapril Non prescription phentermine, Crystal meth and xanax Moexipril Lethal doses of klonopin and xanax Comparison viagra cialis levivia Montelukast No overnight prescription xanax Budesonide Chlorzoxazone Heparin Herbal viagra reviews Indapamide Order viagra now Cialis compare levitra viagra Interstitial cystitis+xanax Natural viagra free samples Cialis dysfunction erectile levitra viagra Cozaar Fatal dose of xanax Ditropan Cefotetan Female use viagra Generic meridia! What do xanax look like Fioricet addiction! Picture of xanax Viagra sale Buy prescription tramadol without Compare ionamin phentermine Fenoterol Carbinoxamine. 92 accepted cod phentermine Xanax? Does viagra woman work Side effects of xanax Butriptyline What is phentermine civ? Cheap tramadol without prescription Ethosuximide Glyburide Phentermine online no prescription, Differin Meridia Xanax and depression Demecarium Dyphylline Femara Furosemide Generic viagra soft tabs Fioricet addiction Phentermine next day delivery Phentermine use Phentermine tricks? Buy vicodin Phentermine money orders Cod tramadol money orders Sparfloxacin Viagra useage Generic purchase viagra Noroxin Will xanax help me sleep while on adderall! Phentermine + sale Selegiline Succinylcholine Cheap viagra in the uk! Orlistat Non perscription generic cialis. Flexeril Butriptyline! Xanax dosing Linkdomain buy online viagra info domain buy onlin Cheap phentermine with online consultation Digitalis: Phentermine shipped to florida Echothiophate Buy viagra in the uk Dulcolax: Viagra female sexual inhancement Molindone No perscription tramadol Cheapest tramadol available online, Phentermine yellow 30 mg Order generic viagra Trazodone Cheapest xanax online Tylenol Add link phentermine purchase suggest? Nizoral Viagra without prescription? Dextrothyroxine Cerivastatin! Famvir Generic cialis Buy and purchase viagra online Adderall skin allegra skin xanax skin Efavirenz Fexofenadine? Phentermine feedback Diet phentermine pill In use viagra woman Trihexyphenidyl Phentermine Pentasa Buy viagra prescription online Why phentermine Simvastatin Buy phentermine online cod Pravachol Phentermine overnight shipping Buy xanax without prescription in usa Paroxetine Pfizer viagra Generic viagra overnight delivery Alternative to phentermine Comparisons on online viagra suppliers Lamictal Buy xanax on line Cafergot Aldactone Cod online pharmacy phentermine sell Order phentermine Discount viagra Prednisone Ticarcillin Corticotropin, Cyclopenthiazide Losec Best phentermine pharmacies compare links Xanax drug testing Scopolamine Eprosartan? Hydrochlorothiazide Methyldopa Mifepristone 100 tramadol Phentermine at cost with no prescription Viagra dosage. Birth defects and phentermine use Pantoprazole Pravachol Erythromycin! Methylphenidate Viagra substitutes? Phentermine dangerous Rofecoxib Cialis drug impotence Information medical phentermine Edrophonium Bad side effects of viagra Cholestyramine Side effects of tramadol hydrochloride! Viagra overdose Phentermine buy best? Buy online viagra where Maxzide Low cost cialis Anisindione Pioglitazone Phentermine ups delivery: Chlorothiazide Capoten Free cialis samples Phentermine uk suppliers Xanax no prescription required Albuterol Drug testing and tramadol Promethazine! Safe internet shopping generic viagraeng Motrin, Lypressin Secobarbital Niaspan Drug testing xanax Methacycline Generic cialis overnight Stopping xanax Online phentermine sale Nisoldipine Triflupromazine Phentermine 37 5 Diazepam Phentermine and sibutramine be combined Xanax online no prescription Hydroflumethiazide Free sample viagra Phentermine hcl Phentermine and blood in stool Viagra alternatives Eldepryl Online pharmacy and phentermine overnight Phentermine vs adipex p Combivent Lasix Viagra cialis Vicodin es Phentermine price comparison Cytomel! Prozac interact xanax Cheapest tramadol Casanthranol Viagra libido Tramadol hcl 50 mg Cheapest online pharmacy phentermine Diet drug loss phentermine weight Is viagra safe for women: Online phentermine no prescription Xanax pics Lomefloxacin Ambien overdose Viagra sample Atarax: Cheap viagra uk Metoprolol Fluphenazine Cialis immunity Non prescription phentermine Adalat What does phentermine do to your heart Hydroxyurea Soma side effects Phentermine withdrawal Thiamine Xanax 1mg Get viagra Ambien rx Tramadol hc Xanax suicide! Imitrex Phentermine online without a prescription, Cyber pharmacy viagra Budesonide Dog xanax Vicodin info Enalapril Tramadol cheap Generic viagra reviews Propylthiouracil? Tools needed for injecting xanax Chlorpropamide Trichlormethiazide Thiphenamil Repaglinide Clofibrate Phentermine 30 mg ordered with discover card Xanax for dogs Discount phentermine price Phenytoin interaction with xanax How quick can you lose weight with phentermine Biperiden Carbamazepine Cefdinir, Xanax withdrawal symptoms Xanax abuse Medrol Miglitol? Plicamycin Amprenavir Viagra alternative Canada xanax Viagra success story Xanax demerol morphine no prescription needed Non perscription viagra Biaxin Phentermine from canada Does phentermine speed up metabolism? Femara Cortisol, Buy viagra online Meridia Suicide xanax Xanax versus prozac! 3mg xanax Viagra conviaindications. Xanax without a prescription Levivia viagra: Discount hydrocodone Encainide Physical symptoms of high blood pressure and xanax Diet pills phentermine Women viagra Viagra investigator What is xanax used for 25 mg viagra, Buy discount viagra online Tolazoline Viagra experience Cod free phentermine shipping. Cosopt Oxazepam Cefixime Xanax addiction treatment Viagra for women Buy online viagra where: Free trial viagra Divalproex Amphetamine Discount online phentermine Mercaptopurine Phentermine without prescription and energy pill: Compare levivia viagra Withdrawal from xanax, Viagra from canada Cheep phentermine Oxcarbazepine About phentermine Phentermine on line Drug interactions with cialis Lexapro and phentermine Cycloserine: James thompson viagra lawsuit Free overnight phentermine shipping Buy phentermine Best price for viagra in the uk Phentermine 37.5 no prescription Tramadol abuse Generic phentermine Phentermine 37.5 mg diet pill Dipyridamole Soma gallery Amiodarone Canada viagra Phentermine free shipping 90 supply no delay James thompson viagra lawsuit Fast phentermine Chromium. How to get a xanax prescription Phentermine and fast shipping? Cialis side effects I need to find cheap phentermine delivered to fl Ibutilide Soma, From generic india viagra Ordering phentermine Luvox and xanax Lexapro Adipex loss phentermine weight Noroxin Ampicilin Mazindol Pravastatin Discount viagra Fioricet description Misoprostol: Compare viagra cialis levitra Paris france cheep viagra? Pharmacy phentermine sister Nuvaring: Estradiol Benadryl Use of viagra Paxil and xanax interaction. Phentermine from a mexican pharmacy Xanax long term use: Liver problems from xanax Heart phentermine Trimethadione Side effects of xanax mylan Clindamycin Mepenzolate? Cheap hydrocodone Estraderm Aciphex Cheap phentermine prescription? Cefotetan Herbal viagra affiliate Ethotoin Ambenonium. Dimethindene Etoposide? Cialis compared to viagra Combivent Phenobarbital Phentermine 15 mg? Online pharmacy tramadol Xanax withdrawal symptoms Vytorin 37.5 phentermine, Withdraw xanax Drug test tramadol hydochloride Lowest phentermine Mexican pharmacies online+xanax Drug prescription tramadol Buy phentermine in the uk Protriptyline Levivia viagra vs. Lanoxin Buy meridia online Xanax drug prescription Free generic sample viagra Natural viagra alternatives Phentermine pill discount Viagra dose Neostigmine Nortriptyline Percocet Herbal alternatives to viagra Cisapride Generic meridia Ergocalciferol Cialis compared to viagra Black market costa rica pharmacy phentermine no imprint code Phentermine sameday overnight saturday delivery Cefatrizine Viagra overnight delivery 1 loss phentermine pill weight! Which is better cialis or levitra Pal pay phentermine Effects of phentermine Online viagra consultation: Piroxicam Acetaminophen Famotidine Tramadol dosage for dogs Does xanax show up on drug tests Diet drug loss phentermine weight Tramadol use in dogs Diet pill addiction phentermine Cheap tramadol online Ganciclovir Viagra commercials Tramadol hydrochloride tablets. Xanax 2mg generic alprazolam 180 pills Scopolamine Flagyl Zanaflex Buy tramadol online Phenylpropanolamine Flexeril Alternative viagra Vicodin drug test Droperidol? Granisetron Xanax Amerge Cialis levitra sales viagra What is xanax Flupenthixol Substitute viagra Discount phentermine to florida Tramadol hydrochloride overdose Viagra class action. Generic sample viagra Allopurinol Xanax addiction treatment Discount viagra online Cialis prices Heparin Levitra Restoril Viagra sales Furosemide: Overnight shipping phentermine Buy cheap fioricet Female viagra alternative Civiate generic sildenafil viagra. Tramadol effects Buy xanax online without a prescription. Micronase Phentermine 37.5 no prescription? Xanax paypal Detection drug in phentermine screen urine Hexachlorophene Buy phentermine with no prescription Viagra suppliers Pyrilamine? Cheapest phentermine 90 day order Phentermine withdrawal symptoms! Information loss phentermine weight Skelaxin Paris cheep phentermine Cefixime Buy phentermine without prescription Methazolamide! Metrizamide Indocin Bayer _cialis et levitra Phentermine insulin Substitute viagra Omeprazole Cheap tramadol no prescription Estrace Mastercard phentermine! Alendronate Vancomycin Phentermine drug interaction Cortisol Tramadol drug Fioricet description, Is there a phentermine shortage Buy viagra pill Loratadine Mark martin uniform jacket team caliber viagra Xanax sale Lopid Buying phentermine without prescription Digitoxin Hydrocodone side effects vicodin Phentermine 37.5 mg Viagra joke Discount phentermine: Insulin Viagra experience Tridihexethyl Cheapest prescription viagra Pediacare Cardizem Phentermine tablets Phentermine success story Phentermine without perscription Price viagra viacreme Micronase Taking phentermine with antidepressants Generic viagra in canada Nalbuphine How fast can you loss weight with phentermine Humulin Elocon Cialis compared to viagra! Phentermine compare prices Best price for generic viagra Flomax Side effects of viagra Phenytoin interaction with xanax Phentermine hci? Ethanol How long does xanax stay in the system Ampicillin Xanax drug tests. Order phentermine diet pill Cruises soma Buy tramadol cheap Cephapirin Niacin Mercaptopurine, Pink oval pill 17 xanax identification Vicodin hp Cefamandole Chinese viagra dragon power Nicardipine Buy ambien online? Lithium Buy cialis viagra Urokinase Effects of long term xanax use Naprosyn Viagra results? Cilostazol Viagra pill picture! Cod free phentermine shipping Phentermine low price, Aerobid Indomethacin, Meridia online Ativan vs xanax Xanax online no prescription Diet pill xanax Cheapest viagra prices Buy levivia viagra Phenyltoloxamine Buying phentermine How long does xanax stay in the system Flutamide Phentermine 15 mgs Phentermine shipped cod Generic fioricet Viagra wholesale Fenoprofen Phentermine pharmacies Plendil Buy cheap soma Cheap 37 5 phentermine Ouabain Anti cialis impotence Phendimetrazine Isotretinoin Xanax long term effects Darvocet Adipexdrug addiction order phentermine online Allopurinol Xanax no prescription required Eldepryl Hydrocodone and ibuprofen Levivia viagra vs Ativan xanax Discount xanax Tessalon Atropine Overnight phentermine no prescription, Motrin Pink oval pill 17 xanax identification? Canada cialis Atorvastatin Order soma carisoprodol Celecoxib Alphaprodine Buy cheap meridia! Provigil Buy cialis generic Nalorphine Buy online purchase viagra, Ketoconazole Prescription xanax Generic soma Phentermine raleigh

Google Maps and Distance Calculating

John | .Net | Wednesday, October 3rd, 2007

At the marketing agency I work for we have just recently finished a medium sized project which required the use of Postcode distance calculating. We looked at several solutions including PostCodeAnywhere, which I have used in the past for other projects, but our concern was the cost of the postcode data. Even obtaining the data directly from the Royal Mail was very expensive. Costs looked likely to be around £2,000 for a setup fee and then ongoing yearly costs of around £500. As the project wasn’t a guaranteed success for the client we wanted to keep the costs down for them.

At the same time of working on this project another team member was using the Google Maps API for putting locations on a map for a different client. As a team we wondered whether we could use the same technology to calculate distances between postcodes, however my concern was that I didn’t want a JavaScript solution as this would mean some of the visitors to the site wouldn’t be able to the search tool effectively. Fortunately Google do also provide some data through an XML service.

http://maps.google.com/maps/geo?q=PostCodeHere&output=xml&key=APIKeyHere

Bingo, that was exactly what we needed. The only limitation was that the maximum number of requests we could make a day were 50,000 but we figured this wouldn’t be an issue. So now we have the capability to get the Latitude and Longitude values for every postcode, so with some simple trigonometry it was possible to calculate the distance as the crow flies. At first the client was worried that this would mean the distances weren’t particularly accurate, but we managed to explain to them that all distance calculators, except for route planners, provided the distance as the crow flies.

The function for calculating the distance can be seen below.
private double CalculateDistance(Coordinates Start, Coordinates End )
{
double distance = 0;
double Lat1 = Start.Latitude;
double Lon1 = Start.Longitude;
double Lat2 = End.Latitude;
double Lon2 = End.Longitude;

// Calculate distance between point (includes taking into account curveture of Earth)
double theta = Lon1 - Lon2;
double dist = Math.Sin(deg2rad(Lat1)) * Math.Sin(deg2rad(Lat2)) + Math.Cos(deg2rad(Lat1)) * Math.Cos(deg2rad(Lat2)) * Math.Cos(deg2rad(theta));
dist = Math.Acos(dist);
dist = rad2deg(dist);
distance = dist * 60 * 1.1515;

return distance;
}

To limit the number of requested we made to Google we decided to store each Postcode with its latitude and longitude in a database table with a timestamp. Once the timestamp is over 6 months old we update the coordinate values.

So a big thanks to Google who have helped us provided a very cost effective solution to not only this client but future clients as well.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress | Theme by Roy Tanck