def export_kmz(filenames, working_directory):
    """
    """
    internal_working_directory = os.path.join(working_directory, "Internal")
    if not os.path.exists(internal_working_directory):
        os.makedirs(internal_working_directory)

    kmzs = []
    for image in filenames:
        size = get_image_size_with_gdal(image)
        warning_size = 0
        # by default, tile size of kmz export is 512
        # if the image size is smaller than 512, the application does not work properly
        if size[0] < 512 or size[1] < 512:
            warning_size = size[0] if (size[0]<size[1]) else size[1]
        kmz_tmp = OTBApplications.otbcli_export_kmz(image, internal_working_directory, warning_size)
        kmzs.append(kmz_tmp)

    # attention rustine
    # kmzs = glob.glob( os.path.join(internal_working_directory, "*.kmz"))
    kmz_to_return = []
    for kmz in kmzs:
        new_path = os.path.join(working_directory, os.path.basename(kmz))
        shutil.copy(kmz, new_path)
        kmz_to_return.append(new_path)

    return kmz_to_return
Beispiel #2
0
def export_kmz(filenames, working_directory):
    """
    """
    internal_working_directory = os.path.join(working_directory, "Internal")
    if not os.path.exists(internal_working_directory):
        os.makedirs(internal_working_directory)

    kmzs = []
    for image in filenames:
        size = get_image_size_with_gdal(image)
        warning_size = 0
        # by default, tile size of kmz export is 512
        # if the image size is smaller than 512, the application does not work properly
        if size[0] < 512 or size[1] < 512:
            warning_size = size[0] if (size[0] < size[1]) else size[1]
        kmz_tmp = OTBApplications.otbcli_export_kmz(
            image, internal_working_directory, warning_size)
        kmzs.append(kmz_tmp)

    # attention rustine
    # kmzs = glob.glob( os.path.join(internal_working_directory, "*.kmz"))
    kmz_to_return = []
    for kmz in kmzs:
        new_path = os.path.join(working_directory, os.path.basename(kmz))
        shutil.copy(kmz, new_path)
        kmz_to_return.append(new_path)

    return kmz_to_return
def export_kmz(filenames, working_directory):
    """
    """
    internal_working_directory = os.path.join(working_directory, "Internal")
    if not os.path.exists(internal_working_directory):
        os.makedirs(internal_working_directory)

    kmzs = []
    for image in filenames:
        kmz_tmp = OTBApplications.otbcli_export_kmz(image, internal_working_directory)
        kmzs.append(kmz_tmp)

    # attention rustine
    # kmzs = glob.glob( os.path.join(internal_working_directory, "*.kmz"))
    kmz_to_return = []
    for kmz in kmzs:
        new_path = os.path.join(working_directory, os.path.basename(kmz))
        shutil.copy(kmz, new_path)
        kmz_to_return.append(new_path)

    return kmz_to_return
Beispiel #4
0
def export_kmz(filenames, working_directory):
    """
    """
    internal_working_directory = os.path.join(working_directory, "Internal")
    if not os.path.exists(internal_working_directory):
        os.makedirs(internal_working_directory)

    kmzs = []
    for image in filenames:
        kmz_tmp = OTBApplications.otbcli_export_kmz(
            image, internal_working_directory)
        kmzs.append(kmz_tmp)

    # attention rustine
    # kmzs = glob.glob( os.path.join(internal_working_directory, "*.kmz"))
    kmz_to_return = []
    for kmz in kmzs:
        new_path = os.path.join(working_directory, os.path.basename(kmz))
        shutil.copy(kmz, new_path)
        kmz_to_return.append(new_path)

    return kmz_to_return