當前位置: 首頁>>代碼示例>>Python>>正文


Python gdal.GeneralCmdLineProcessor方法代碼示例

本文整理匯總了Python中osgeo.gdal.GeneralCmdLineProcessor方法的典型用法代碼示例。如果您正苦於以下問題:Python gdal.GeneralCmdLineProcessor方法的具體用法?Python gdal.GeneralCmdLineProcessor怎麽用?Python gdal.GeneralCmdLineProcessor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在osgeo.gdal的用法示例。


在下文中一共展示了gdal.GeneralCmdLineProcessor方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from osgeo import gdal [as 別名]
# 或者: from osgeo.gdal import GeneralCmdLineProcessor [as 別名]
def main():
    # TODO: gbataille - use mkdtemp to work in a temp directory
    # TODO: gbataille - debug intermediate tiles.vrt not produced anymore?
    # TODO: gbataille - Refactor generate overview tiles to not depend on self variables
    argv = gdal.GeneralCmdLineProcessor(sys.argv)
    input_file, output_folder, options = process_args(argv[1:])
    nb_processes = options.nb_processes or 1

    if nb_processes == 1:
        single_threaded_tiling(input_file, output_folder, options)
    else:
        multi_threaded_tiling(input_file, output_folder, options) 
開發者ID:Luqqk,項目名稱:gdal2tiles,代碼行數:14,代碼來源:gdal2tiles.py

示例2: main

# 需要導入模塊: from osgeo import gdal [as 別名]
# 或者: from osgeo.gdal import GeneralCmdLineProcessor [as 別名]
def main(argv=None):
    argv = gdal.GeneralCmdLineProcessor(sys_argv)
    if argv:
        gdal2tiles = GDAL2Tiles(argv[1:])  # handle command line options

        print("Begin metadata generation complete.")
        p = Process(target=worker_metadata, args=[argv])
        p.start()
        p.join()
        print("Metadata generation complete.")

        pool = Pool()
        #processed_tiles = 0
        print("Generating Base Tiles:")
        for cpu in range(gdal2tiles.options.processes):
            pool.apply_async(worker_base_tiles,
                             [argv, cpu],
                             callback=worker_callback)
        pool.close()
        # This progress code does not work. The queue deadlocks the pool.join() call.
        #while len(active_children()) != 0:
        #   try:
        #       total = queue.get(timeout=1)
        #       processed_tiles += 1
        #       gdal.TermProgress_nocb(processed_tiles / float(total))
        #       stdout.flush()
        #   except:
        #       pass
        pool.join()
        print("Base tile generation complete.")

        #processed_tiles = 0
        tminz, tmaxz = getZooms(gdal2tiles)
        print("Generating Overview Tiles:")
        for tz in range(tmaxz - 1, tminz - 1, -1):
            print("\tGenerating for zoom level: " + str(tz))
            pool = Pool()
            for cpu in range(gdal2tiles.options.processes):
                pool.apply_async(worker_overview_tiles, [argv, cpu, tz])
            pool.close()
            #while len(active_children()) != 0:
            #   try:
            #       total = queue.get(timeout=1)
            #       processed_tiles += 1
            #       gdal.TermProgress_nocb(processed_tiles / float(total))
            #       stdout.flush()
            #   except:
            #       pass
            pool.join()
            print("\tZoom level " + str(tz) + " complete.")
        print("Overview tile generation complete") 
開發者ID:GitHubRGI,項目名稱:geopackage-python,代碼行數:53,代碼來源:gdal2tiles_parallel.py


注:本文中的osgeo.gdal.GeneralCmdLineProcessor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。