def main(): print() print("------------------M Y P L A C E S------------------") eiffel_tower = make_eiffel() louvre_museum = make_louvre() space_needle = make_needle() statue_of_liberty = make_liberty() leaning_tower_of_pisa = make_pisa() print(eiffel_tower) print("-----------------------------------------------------") print(louvre_museum) print("-----------------------------------------------------") print(space_needle) print("-----------------------------------------------------") print(statue_of_liberty) print("-----------------------------------------------------") print(leaning_tower_of_pisa) print("-----------------------------------------------------\n") print("---------------D I S T A N C E F R O M--------------") print("Louvre Museum from Eiffel Tower:", round(eiffel_tower.distance_from(louvre_museum), 2)) print("Louvre Museum from Statue of Liberty:", round(statue_of_liberty.distance_from(louvre_museum), 2)) print("Statue of Liberty from Leaning Tower of Pisa:", round(leaning_tower_of_pisa.distance_from(statue_of_liberty), 2)) print("-----------------------------------------------------\n") print("------F I N D P L A C E W I T H G E O L O C A T I O N------") search(GeoLocation(48.859556, 2.294441)) print("-----------------------------------------------------")
def getPhotoObject(self): os.chdir('..') execution_path = os.getcwd() detector = ObjectDetection() detector.setModelTypeAsYOLOv3() detector.setModelPath(os.path.join(execution_path, "yolo.h5")) detector.loadModel() media_path = self.navigateToMediaDir() photos = {} for name in os.listdir('.'): with open(name, "r") as read_file: data = json.load(read_file) for key in data['photos']: detection_types = self.getObjectTypes( detector, media_path, key['uri']) geolocation = GeoLocation() geo_loc = geolocation.getLongLatFromIP( str(key['media_metadata']['photo_metadata'] ['upload_ip'])) photos[str(key['uri']).split('/')[2]] = { 'category': data['name'], 'uri': str(key['uri']).split('/')[2], 'geo': geo_loc, 'detection_types': detection_types } return photos
end_time = time.time() print "Time for generating " + str(number_of_points) + " points: " + str( end_time - start_time) return gps_tuples def printKnn(kNN): for result in kNN: print str(result[0]) + ", distance: " + str(result[1]) print "" if __name__ == "__main__": #gps_tuples = generate_test_points() gps_tuples = generate_random_points() geolocation = GeoLocation() start_time = time.time() geolocation.load_points(gps_tuples) end_time = time.time() print "Time for creating the kd-Tree: " + str(end_time - start_time) #geolocation.load_points(gps_tuples) test_point = GPSPoint("Maze 9 Tel Aviv", 12.3234, -12.234) #test_point = Point("Bastille paris", 48.862592, 2.347260) #lat = raw_input("Test point - Latitude: ") #lon = raw_input("Test point - Longitude: ") for k in xrange(1, 2): #print testPoint.distance(ny); #k = int(raw_input("How many nearest neighbors? (K): "))
def make_eiffel(): eiffel_name = "Eiffel Tower" eiffel_address = "Eiffel Tower, 75007 Paris, France" eiffel_tag = "France Tower" eiffel_location = GeoLocation(48.859556, 2.294441) return Place(eiffel_name, eiffel_address, eiffel_tag, eiffel_location)
def make_pisa(): pisa_name = "Leaning Tower of Pisa" pisa_address = "56126 Pisa, Province of Pisa, Italy" pisa_tag = "Italy Tower" pisa_location = GeoLocation(43.723099, 10.396629) return Place(pisa_name, pisa_address, pisa_tag, pisa_location)
def make_liberty(): liberty_name = "Statue of Liberty" liberty_address = "Liberty Island, New York, NY 10004" liberty_tag = "New York Monument" liberty_location = GeoLocation(40.689355, -74.044468) return Place(liberty_name, liberty_address, liberty_tag, liberty_location)
def make_needle(): needle_name = "Space Needle" needle_address = "Queen Anne, Seattle, WA 98109" needle_tag = "Seattle Tower" needle_location = GeoLocation(47.620761, -122.348531) return Place(needle_name, needle_address, needle_tag, needle_location)
def make_louvre(): louvre_name = "Louvre Museum" louvre_address = "Cour Carrée, 75001 Paris, France" louvre_tag = "France Museum" louvre_location = GeoLocation(48.860717, 2.337708) return Place(louvre_name, louvre_address, louvre_tag, louvre_location)