예제 #1
0
 def interpret_gnss_loc(self, location_result_structure):
     coordinate_array = location_result_structure["llh"]
     gnss_coordinate = Coordinate(
         latitude=coordinate_array[0],
         longitude=coordinate_array[1],
         altitude=coordinate_array[2],
     )
     metadata = None
     return gnss_coordinate, metadata
 def from_csv_line(csv_line):
     match_line = ExternalCoordinate.regexp_csv_line.match(csv_line.strip())
     if match_line:
         external_id = match_line.group("external_id")
         coordinate = Coordinate.from_string(match_line.group("coordinate"))
         return ExternalCoordinate(external_id=external_id,
                                   coordinate=coordinate)
     else:
         raise ExternalCoordinateMalformedCsvLineException(csv_line)
예제 #3
0
    def get_coordinate_accuracy_from_result(self, response_dict):
        RESULT_KEY = "result"
        ACCURACY_KEY = "accuracy"
        REFERENTIAL_KEY = "llh"

        latitude = float(response_dict[RESULT_KEY][REFERENTIAL_KEY][0])
        longitude = float(response_dict[RESULT_KEY][REFERENTIAL_KEY][1])
        altitude = float(response_dict[RESULT_KEY][REFERENTIAL_KEY][2])
        coordinate = Coordinate(latitude=latitude,
                                longitude=longitude,
                                altitude=altitude)
        accuracy = float(response_dict[RESULT_KEY][ACCURACY_KEY])
        return coordinate, accuracy
예제 #4
0
    def get_coordinate_accuracy_from_result(self, result_device):
        POSITION_SOLUTION_KEY = "position_solution"
        ACCURACY_KEY = "accuracy"
        REFERENTIAL_KEY = "llh"

        latitude = float(
            result_device[POSITION_SOLUTION_KEY][REFERENTIAL_KEY][0])
        longitude = float(
            result_device[POSITION_SOLUTION_KEY][REFERENTIAL_KEY][1])
        altitude = float(
            result_device[POSITION_SOLUTION_KEY][REFERENTIAL_KEY][2])
        coordinate = Coordinate(latitude=latitude,
                                longitude=longitude,
                                altitude=altitude)
        accuracy = float(result_device[POSITION_SOLUTION_KEY][ACCURACY_KEY])
        return coordinate, accuracy
예제 #5
0
    def build_response(self, http_code, response_text):
        response_dict = loads(response_text)

        RESULT_KEY = "result"
        LATITUDE_KEY = "latitude"
        LONGITUDE_KEY = "longitude"
        ALTITUDE_KEY = "altitude"
        ACCURACY_KEY = "accuracy"

        coordinates = Coordinate(
            latitude=float(response_dict[RESULT_KEY][LATITUDE_KEY]),
            longitude=float(response_dict[RESULT_KEY][LONGITUDE_KEY]),
            altitude=float(response_dict[RESULT_KEY][ALTITUDE_KEY]),
        )
        loc_accuracy = int(response_dict[RESULT_KEY][ACCURACY_KEY])
        response = ResponseSuccessBase(
            http_code=http_code,
            raw_response=response_text,
            estimated_coordinate=coordinates,
            accuracy=loc_accuracy,
        )
        return response