예제 #1
0
def create_shp_with_info(port_shp_file, deadweight_db, deadweight_table,
                         source_csv_file, target_path, split_csv_file,
                         format_txt_file, static_info_file_for_shp, shp_file,
                         split_trajectory_degree):
    split_count = split_source_csv_file(source_csv_file, target_path,
                                        split_csv_file)

    port_service = PortService(port_shp_file)

    deadweights = DeadweightDB(deadweight_db)
    deadweights.init_ships_deadweight(deadweight_table)

    for i in range(split_count):
        os.chdir(os.path.join(target_path, str(i)))

        Utils.convert_csv_to_format_txt(split_csv_file, format_txt_file,
                                        port_service, split_trajectory_degree)

        Utils.get_trajectory_static_info_file(split_csv_file, deadweights,
                                              static_info_file_for_shp,
                                              static_info_file_header,
                                              split_trajectory_degree)

    Utils.create_shp(format_txt_file, shp_file)
    return
예제 #2
0
def check_file_by_creating_trajectory():
    mmsi = 215153000
    filename = r"D:\graduation\data\step_result\check\step4\trajectory_{}.csv".format(
        mmsi)
    target_file_name = r"D:\graduation\data\step_result\check\step4\trajectory_{}.txt".format(
        mmsi)
    port_name = r"D:\GeoData\Port\WPI.shp"
    degree_threshold = Const.LINE_NO_SPLIT_DEGREE

    port_service = PortService(port_name)
    Utils.convert_csv_to_format_txt(filename, target_file_name, port_service,
                                    degree_threshold)

    shp_file_name = r"D:\graduation\data\step_result\check\step4\trajectory_{}.shp".format(
        mmsi)
    Utils.create_shp(target_file_name, shp_file_name)
예제 #3
0
def step5_convert_csv_to_format_txt(file_name, degree_threshold):
    port_service = PortService(Config.port_name)

    Utils.convert_csv_to_format_txt(file_name,
                                    file_name.replace('.csv', '.txt'),
                                    port_service, degree_threshold)