Beispiel #1
0
    def jumpNear(self, location):
        # Get a list of nearby panoramas
        panos = SVCloud.get_nearby_db_metadata(location)
        if len(panos) == 0:
            print "No nearby panoramas are in the database."
            sv_pano = SVCloud.get_nearby_sv_metadata(location)
            if sv_pano:
               panos.append(sv_pano)
            else:
               print "No nearby panoramas are in Street View."
               return

        # Find the closest one, using the taxicab metric for now...
        closest_pano = panos[0]
        min_d = abs(location.lat - closest_pano.location.lat) + abs(location.lon - closest_pano.location.lon)
        for pano in panos:
            d = abs(location.lat - pano.location.lat) + abs(location.lon - pano.location.lon)
            if d < min_d:
                closest_pano = pano
                min_d = d
        self.set_pano(closest_pano)