-
Notifications
You must be signed in to change notification settings - Fork 0
/
calculator.js
12 lines (7 loc) · 3.09 KB
/
calculator.js
1
2
3
4
5
6
7
8
9
10
11
12
function get_closest(lat, lng) {
// 1. USE THIS DUMMY OBJECT FOR TESTING WHERE EACH ITEM IS (city_name, lattitude, longitude)
data = [["AielloDelFriuli",45.8717,13.3656],["Haps",51.688,5.8638],["Lorentzweiler",49.6947,6.1425],["Frjus",43.4329,6.7352],["SanBonifacio",45.4,11.2667],["Montramito",47.7167,10.3],["Sandillon",47.8451,2.0316],["Drieborg",53.2075,7.1813],["Prenchies",50.6701,2.9702],["Lathuy",50.7167,4.8333],["Schrattenberg",48.7167,16.7167],["Salmentaka",61.4,24.4],["Yinwan",33.7369,109.2714],["InnereStadt",48.2167,16.3667],["Babenham",48.0333,13.15],["Yalta",44.5001,34.1615],["Dayangshu",29.5803,112.2189],["Katsumi",35.5333,135.7167],["Anqiu",36.4342,119.1925],["Niewiesze",50.4,18.4833],["Oscoda",44.4532,-83.5409],["SantaYnez",34.6452,-120.0244],["Nobel",51.8669,25.7657],["Serres",45.1814,3.7246],["Seyhan",36.9875,35.3059],["Laussa",47.95,14.45],["Concha",43.2225,-3.3572],["StaryFolwark",54.0833,23],["Traunfeld",48.4333,16.5167],["Pelton",54.8667,-1.6],["Carmel",39.9738,-86.1765],["Tangmere",50.85,-0.7167],["Clarksdale",34.1729,-90.6075],["Plattenhardt",48.65,9.2],["Chiuppano",45.7667,11.4667],["Lookout",38.0654,-80.9725],["Sedrun",46.6816,8.7786],["Caughnawaga",45.4167,-73.6833],["Ziethen",53.7,10.8167],["Brdudvarnok",46.3264,17.6861],["Yuandi",27.9864,118.8719],["Lunda",60.1167,18.0667],["Isigny",48.617,-1.1699],["Robbins",41.6419,-87.7096],["Rosarno",38.4833,15.9667],["Rymttyl",60.3667,21.95],["Challacombe",51.15,-3.8833],["Wathupitiwala",7.1167,80.1],["Cardenal",40.3528,-5.4267],["Yakovlev",55.7756,35.288],["Oscarsborg",68.4333,17.4333],["Boitzenburg",53.2667,13.6],["Weststeiermark",46.85,15.3167],["Roznowice",52.7,16.8667],["Sagamihara",35.5531,139.3544],["Boyu",26.3167,105.6833],["Brekke",59.4333,11.2333],["Oconto",44.8859,-87.9407],["Gilford",43.5389,-71.3864],["Jarosty",51.4626,19.6687],["Lannon",43.1533,-88.1642],["Ardingly",51.0333,-0.0833],["Simssee",47.8667,12.2167],["Decazeville",44.5604,2.2541],["Krakaudorf",47.1667,14.0167],["Moste",46.05,14.55],["Itens",53.0999,5.6475],["Yli-ii",65.3667,25.8333],["Maslovo",59.2886,61.2803],["Ludzmierz",49.4667,19.9833],["Cefal",38.0333,14.0167],["Chenies",51.6667,-0.5167],["Gladbeck",51.5667,6.9833],["Rros",62.5833,11.4],["Carlatan",16.6347,120.3233],["Radziejowice",52,20.55],["Bustos",40.4963,-8.6008],["Heilshorn",53.2333,8.7167],["LePont",45.8,0.3333],["Schauinsland",47.9333,7.9],["Anda",55.6048,45.5937],["Castelguelfo",44.8333,10.1833],["Oelsa",50.95,13.6667],["Ratzeburg",53.7,10.7667],["Veteli",63.4667,23.7667],["Selmsdorf",53.8833,10.8667],["Welt",54.3,8.8],["Shooshtar",32.0455,48.8567],["DosRios",39.7357,-123.3341],["Ravenel",32.8073,-80.2584],["Rovinj",45.08,13.64],["Longxi",35.0047,104.6394],["Velma",34.4601,-97.6739],["Sermoneta",41.55,12.9833],["SocialCircle",33.6476,-83.6969],["Groholbach",50.45,7.8833],["Kinzers",40.0107,-76.0585],["Hodeng",49.5281,1.5694],["Jidong",45.2167,131.0833],["Meidong",18.3708,109.0056]]
// 2. PROCESSING GOES HERE
// 3. RETURN DATA IN SHAPE LIKE THIS
return [["Kuras", 54.9333, 23.55], ["Livigno", 46.5333, 10.0667], ["Nyberg", 60.4833, 15.9], ["Shunchi", 27.5706, 120.1958], ["Kamppi", 60.1683, 24.9325]];
}