• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python test_cli_utilities.get_gdalbuildvrt_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中test_cli_utilities.get_gdalbuildvrt_path函数的典型用法代码示例。如果您正苦于以下问题:Python get_gdalbuildvrt_path函数的具体用法?Python get_gdalbuildvrt_path怎么用?Python get_gdalbuildvrt_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_gdalbuildvrt_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_gdalbuildvrt_9

def test_gdalbuildvrt_9():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return "skip"

    gdaltest.runexternal(
        test_cli_utilities.get_gdalbuildvrt_path()
        + " -te 1 46 5 50 tmp/mosaic2.vrt tmp/gdalbuildvrt1.tif tmp/gdalbuildvrt2.tif tmp/gdalbuildvrt3.tif tmp/gdalbuildvrt4.tif"
    )

    ds = gdal.Open("tmp/mosaic2.vrt")

    gt = ds.GetGeoTransform()
    expected_gt = [1, 0.1, 0, 50, 0, -0.1]
    for i in range(6):
        if abs(gt[i] - expected_gt[i] > 1e-5):
            gdaltest.post_reason("Expected : %s\nGot : %s" % (expected_gt, gt))
            return "fail"

    if ds.RasterXSize != 40 or ds.RasterYSize != 40:
        gdaltest.post_reason("Wrong raster dimensions : %d x %d" % (ds.RasterXSize, ds.RasterYSize))
        return "fail"

    gdaltest.runexternal(test_cli_utilities.get_gdalbuildvrt_path() + " -te 2 47 4 49 tmp/mosaic.vrt tmp/mosaic2.vrt")

    return test_gdalbuildvrt_check()
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:25,代码来源:test_gdalbuildvrt.py


示例2: vrtmask_4

def vrtmask_4():
    import test_cli_utilities

    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return "skip"

    gtiff_drv = gdal.GetDriverByName("GTiff")
    md = gtiff_drv.GetMetadata()
    if md["DMD_CREATIONOPTIONLIST"].find("JPEG") == -1:
        return "skip"

    gdaltest.runexternal(
        test_cli_utilities.get_gdalbuildvrt_path() + " tmp/vrtmask_4.vrt ../gcore/data/ycbcr_with_mask.tif"
    )

    src_ds = gdal.Open("../gcore/data/ycbcr_with_mask.tif")
    expected_msk_cs = src_ds.GetRasterBand(1).GetMaskBand().Checksum()
    src_ds = None

    ds = gdal.Open("tmp/vrtmask_4.vrt")
    msk_cs = ds.GetRasterBand(1).GetMaskBand().Checksum()
    ds = None

    os.remove("tmp/vrtmask_4.vrt")

    if msk_cs != expected_msk_cs:
        gdaltest.post_reason("did not get expected mask band checksum")
        print(msk_cs)
        print(expected_msk_cs)
        return "fail"

    return "success"
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:32,代码来源:vrtmask.py


示例3: test_gdalbuildvrt_14

def test_gdalbuildvrt_14():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return "skip"
    if test_cli_utilities.get_gdal_translate_path() is None:
        return "skip"

    gdaltest.runexternal(
        test_cli_utilities.get_gdalbuildvrt_path()
        + " tmp/test_gdalbuildvrt_14.vrt ../gcore/data/byte.tif -r cubic -tr 30 30"
    )

    gdaltest.runexternal(
        test_cli_utilities.get_gdal_translate_path()
        + " -of VRT ../gcore/data/byte.tif tmp/test_gdalbuildvrt_14_ref.vrt -r cubic -outsize 40 40"
    )

    ds = gdal.Open("tmp/test_gdalbuildvrt_14.vrt")
    ds_ref = gdal.Open("tmp/test_gdalbuildvrt_14_ref.vrt")
    cs = ds.GetRasterBand(1).Checksum()
    cs_ref = ds_ref.GetRasterBand(1).Checksum()
    ds = None
    ds_ref = None

    if cs != cs_ref:
        gdaltest.post_reason("fail")
        print(cs)
        print(cs_ref)
        return "fail"

    return "success"
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:30,代码来源:test_gdalbuildvrt.py


示例4: test_gdalbuildvrt_7

def test_gdalbuildvrt_7():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return "skip"

    out_ds = gdal.GetDriverByName("GTiff").Create("tmp/vrtnull1.tif", 20, 10, 3, gdal.GDT_UInt16)
    out_ds.SetGeoTransform([2, 0.1, 0, 49, 0, -0.1])
    srs = osr.SpatialReference()
    srs.SetFromUserInput("EPSG:4326")
    out_ds.SetProjection(srs.ExportToWkt())
    out_ds.GetRasterBand(1).SetRasterColorInterpretation(gdal.GCI_RedBand)
    out_ds.GetRasterBand(2).SetRasterColorInterpretation(gdal.GCI_GreenBand)
    out_ds.GetRasterBand(3).SetRasterColorInterpretation(gdal.GCI_BlueBand)
    out_ds.GetRasterBand(1).SetNoDataValue(256)

    try:
        ff = "\xff".encode("latin1")
    except:
        ff = "\xff"

    out_ds.GetRasterBand(1).WriteRaster(0, 0, 10, 10, ff, buf_type=gdal.GDT_Byte, buf_xsize=1, buf_ysize=1)
    out_ds.GetRasterBand(2).WriteRaster(0, 0, 10, 10, "\x00", buf_type=gdal.GDT_Byte, buf_xsize=1, buf_ysize=1)
    out_ds.GetRasterBand(3).WriteRaster(0, 0, 10, 10, "\x00", buf_type=gdal.GDT_Byte, buf_xsize=1, buf_ysize=1)
    out_ds = None

    out_ds = gdal.GetDriverByName("GTiff").Create("tmp/vrtnull2.tif", 20, 10, 3, gdal.GDT_UInt16)
    out_ds.SetGeoTransform([2, 0.1, 0, 49, 0, -0.1])
    srs = osr.SpatialReference()
    srs.SetFromUserInput("EPSG:4326")
    out_ds.SetProjection(srs.ExportToWkt())
    out_ds.GetRasterBand(1).SetRasterColorInterpretation(gdal.GCI_RedBand)
    out_ds.GetRasterBand(2).SetRasterColorInterpretation(gdal.GCI_GreenBand)
    out_ds.GetRasterBand(3).SetRasterColorInterpretation(gdal.GCI_BlueBand)
    out_ds.GetRasterBand(1).SetNoDataValue(256)

    out_ds.GetRasterBand(1).WriteRaster(10, 0, 10, 10, "\x00", buf_type=gdal.GDT_Byte, buf_xsize=1, buf_ysize=1)
    out_ds.GetRasterBand(2).WriteRaster(10, 0, 10, 10, ff, buf_type=gdal.GDT_Byte, buf_xsize=1, buf_ysize=1)
    out_ds.GetRasterBand(3).WriteRaster(10, 0, 10, 10, "\x00", buf_type=gdal.GDT_Byte, buf_xsize=1, buf_ysize=1)
    out_ds = None

    gdaltest.runexternal(
        test_cli_utilities.get_gdalbuildvrt_path() + " tmp/gdalbuildvrt7.vrt tmp/vrtnull1.tif tmp/vrtnull2.tif"
    )

    ds = gdal.Open("tmp/gdalbuildvrt7.vrt")

    if ds.GetRasterBand(1).Checksum() != 1217:
        gdaltest.post_reason("Wrong checksum")
        return "fail"

    if ds.GetRasterBand(2).Checksum() != 1218:
        gdaltest.post_reason("Wrong checksum")
        return "fail"

    if ds.GetRasterBand(3).Checksum() != 0:
        gdaltest.post_reason("Wrong checksum")
        return "fail"

    ds = None

    return "success"
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:60,代码来源:test_gdalbuildvrt.py


示例5: vrtmask_4

def vrtmask_4():
    import test_cli_utilities
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return 'skip'

    gtiff_drv = gdal.GetDriverByName('GTiff')
    md = gtiff_drv.GetMetadata()
    if md['DMD_CREATIONOPTIONLIST'].find('JPEG') == -1:
        return 'skip'

    gdaltest.runexternal(test_cli_utilities.get_gdalbuildvrt_path() + ' tmp/vrtmask_4.vrt ../gcore/data/ycbcr_with_mask.tif')

    src_ds = gdal.Open('../gcore/data/ycbcr_with_mask.tif')
    expected_msk_cs = src_ds.GetRasterBand(1).GetMaskBand().Checksum()
    src_ds = None

    ds = gdal.Open('tmp/vrtmask_4.vrt')
    msk_cs = ds.GetRasterBand(1).GetMaskBand().Checksum()
    ds = None

    os.remove('tmp/vrtmask_4.vrt')

    if msk_cs != expected_msk_cs:
        gdaltest.post_reason('did not get expected mask band checksum')
        print(msk_cs)
        print(expected_msk_cs)
        return 'fail'

    return 'success'
开发者ID:ksshannon,项目名称:gdal,代码行数:29,代码来源:vrtmask.py


示例6: test_gdalbuildvrt_2

def test_gdalbuildvrt_2():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return "skip"
    if test_cli_utilities.get_gdaltindex_path() is None:
        return "skip"

    try:
        os.remove("tmp/tileindex.shp")
    except:
        pass
    try:
        os.remove("tmp/tileindex.dbf")
    except:
        pass
    try:
        os.remove("tmp/tileindex.shx")
    except:
        pass
    try:
        os.remove("tmp/mosaic.vrt")
    except:
        pass

    gdaltest.runexternal(
        test_cli_utilities.get_gdaltindex_path()
        + " tmp/tileindex.shp tmp/gdalbuildvrt1.tif tmp/gdalbuildvrt2.tif tmp/gdalbuildvrt3.tif tmp/gdalbuildvrt4.tif"
    )

    gdaltest.runexternal(test_cli_utilities.get_gdalbuildvrt_path() + " tmp/mosaic.vrt tmp/tileindex.shp")

    return test_gdalbuildvrt_check()
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:31,代码来源:test_gdalbuildvrt.py


示例7: test_gdalbuildvrt_16

def test_gdalbuildvrt_16():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return 'skip'

    (out, err) = gdaltest.runexternal_out_and_err(test_cli_utilities.get_gdalbuildvrt_path() + ' /non_existing_dir/non_existing_subdir/out.vrt ../gcore/data/byte.tif')

    if 'TRAVIS_BRANCH' in os.environ:
        val = os.environ['TRAVIS_BRANCH']
    else:
        val = ''
    if val.find('mingw') < 0:
        if err.find('ERROR ret code = 1') < 0:
            gdaltest.post_reason('fail')
            print(out)
            print(err)
            return 'fail'
    else:
        # We don't get the error code on Travis mingw
        if err.find('ERROR') < 0:
            gdaltest.post_reason('fail')
            print(out)
            print(err)
            return 'fail'

    return 'success'
开发者ID:nextgis-borsch,项目名称:tests,代码行数:25,代码来源:test_gdalbuildvrt.py


示例8: test_gdalbuildvrt_12

def test_gdalbuildvrt_12():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return 'skip'

    (out, err) = gdaltest.runexternal_out_and_err(test_cli_utilities.get_gdalbuildvrt_path() + ' -tap tmp/gdalbuildvrt12.vrt ../gcore/data/byte.tif',
                                                  check_memleak = False)
    if err.find('-tap option cannot be used without using -tr') == -1:
        gdaltest.post_reason('expected error')
        return 'fail'

    gdaltest.runexternal(test_cli_utilities.get_gdalbuildvrt_path() + ' -tr 100 50 -tap tmp/gdalbuildvrt12.vrt ../gcore/data/byte.tif')

    ds = gdal.Open('tmp/gdalbuildvrt12.vrt')

    gt = ds.GetGeoTransform()
    expected_gt = [ 440700.0, 100.0, 0.0, 3751350.0, 0.0, -50.0 ]
    for i in range(6):
        if abs(gt[i] - expected_gt[i] > 1e-5):
            gdaltest.post_reason('Expected : %s\nGot : %s' % (expected_gt, gt) )
            return 'fail'

    if ds.RasterXSize != 13 or ds.RasterYSize != 25:
        gdaltest.post_reason('Wrong raster dimensions : %d x %d' % (ds.RasterXSize, ds.RasterYSize) )
        return 'fail'

    return 'success'
开发者ID:nextgis-borsch,项目名称:tests,代码行数:26,代码来源:test_gdalbuildvrt.py


示例9: test_gdalbuildvrt_11

def test_gdalbuildvrt_11():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return 'skip'

    out_ds = gdal.GetDriverByName('GTiff').Create('tmp/test_gdalbuildvrt_11_1.tif', 10, 10, 1)
    out_ds.GetRasterBand(1).Fill(255)
    cs1 = out_ds.GetRasterBand(1).Checksum()
    out_ds = None

    out_ds = gdal.GetDriverByName('GTiff').Create('tmp/test_gdalbuildvrt_11_2.tif', 10, 10, 1)
    out_ds.GetRasterBand(1).Fill(127)
    cs2 = out_ds.GetRasterBand(1).Checksum()
    out_ds = None

    gdaltest.runexternal(test_cli_utilities.get_gdalbuildvrt_path() + ' -separate tmp/gdalbuildvrt11.vrt tmp/test_gdalbuildvrt_11_1.tif tmp/test_gdalbuildvrt_11_2.tif')

    ds = gdal.Open('tmp/gdalbuildvrt11.vrt')

    if ds.GetRasterBand(1).Checksum() != cs1:
        print(ds.GetRasterBand(1).Checksum())
        print(cs1)
        gdaltest.post_reason('Wrong checksum')
        return 'fail'

    if ds.GetRasterBand(2).Checksum() != cs2:
        print(ds.GetRasterBand(2).Checksum())
        print(cs2)
        gdaltest.post_reason('Wrong checksum')
        return 'fail'

    ds = None

    return 'success'
开发者ID:nextgis-borsch,项目名称:tests,代码行数:33,代码来源:test_gdalbuildvrt.py


示例10: test_gdalbuildvrt_6

def test_gdalbuildvrt_6():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return "skip"

    gdaltest.runexternal(
        test_cli_utilities.get_gdalbuildvrt_path()
        + " -separate tmp/stacked.vrt tmp/gdalbuildvrt1.tif tmp/gdalbuildvrt2.tif tmp/gdalbuildvrt3.tif tmp/gdalbuildvrt4.tif"
    )

    ds = gdal.Open("tmp/stacked.vrt")
    if ds.GetProjectionRef().find("WGS 84") == -1:
        gdaltest.post_reason("Expected WGS 84\nGot : %s" % (ds.GetProjectionRef()))
        return "fail"

    gt = ds.GetGeoTransform()
    expected_gt = [2, 0.1, 0, 49, 0, -0.1]
    for i in range(6):
        if abs(gt[i] - expected_gt[i] > 1e-5):
            gdaltest.post_reason("Expected : %s\nGot : %s" % (expected_gt, gt))
            return "fail"

    if ds.RasterXSize != 20 or ds.RasterYSize != 20:
        gdaltest.post_reason("Wrong raster dimensions : %d x %d" % (ds.RasterXSize, ds.RasterYSize))
        return "fail"

    if ds.RasterCount != 4:
        gdaltest.post_reason("Wrong raster count : %d " % (ds.RasterCount))
        return "fail"

    if ds.GetRasterBand(1).Checksum() != 0:
        gdaltest.post_reason("Wrong checksum")
        return "fail"

    return "success"
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:34,代码来源:test_gdalbuildvrt.py


示例11: test_gdalbuildvrt_12

def test_gdalbuildvrt_12():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return "skip"

    (out, err) = gdaltest.runexternal_out_and_err(
        test_cli_utilities.get_gdalbuildvrt_path() + " -tap tmp/gdalbuildvrt12.vrt ../gcore/data/byte.tif",
        check_memleak=False,
    )
    if err.find("-tap option cannot be used without using -tr") == -1:
        gdaltest.post_reason("expected error")
        return "fail"

    gdaltest.runexternal(
        test_cli_utilities.get_gdalbuildvrt_path() + " -tr 100 50 -tap tmp/gdalbuildvrt12.vrt ../gcore/data/byte.tif"
    )

    ds = gdal.Open("tmp/gdalbuildvrt12.vrt")

    gt = ds.GetGeoTransform()
    expected_gt = [440700.0, 100.0, 0.0, 3751350.0, 0.0, -50.0]
    for i in range(6):
        if abs(gt[i] - expected_gt[i] > 1e-5):
            gdaltest.post_reason("Expected : %s\nGot : %s" % (expected_gt, gt))
            return "fail"

    if ds.RasterXSize != 13 or ds.RasterYSize != 25:
        gdaltest.post_reason("Wrong raster dimensions : %d x %d" % (ds.RasterXSize, ds.RasterYSize))
        return "fail"

    return "success"
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:30,代码来源:test_gdalbuildvrt.py


示例12: test_gdalbuildvrt_7

def test_gdalbuildvrt_7():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return 'skip'

    out_ds = gdal.GetDriverByName('GTiff').Create('tmp/vrtnull1.tif', 20, 10, 3, gdal.GDT_UInt16)
    out_ds.SetGeoTransform([2, 0.1, 0, 49, 0, -0.1])
    srs = osr.SpatialReference()
    srs.SetFromUserInput('EPSG:4326')
    out_ds.SetProjection(srs.ExportToWkt())
    out_ds.GetRasterBand(1).SetRasterColorInterpretation(gdal.GCI_RedBand)
    out_ds.GetRasterBand(2).SetRasterColorInterpretation(gdal.GCI_GreenBand)
    out_ds.GetRasterBand(3).SetRasterColorInterpretation(gdal.GCI_BlueBand)
    out_ds.GetRasterBand(1).SetNoDataValue(256)

    try:
        ff = '\xff'.encode('latin1')
    except UnicodeDecodeError:
        ff = '\xff'

    out_ds.GetRasterBand(1).WriteRaster(0, 0, 10, 10, ff, buf_type=gdal.GDT_Byte, buf_xsize=1, buf_ysize=1)
    out_ds.GetRasterBand(2).WriteRaster(0, 0, 10, 10, '\x00', buf_type=gdal.GDT_Byte, buf_xsize=1, buf_ysize=1)
    out_ds.GetRasterBand(3).WriteRaster(0, 0, 10, 10, '\x00', buf_type=gdal.GDT_Byte, buf_xsize=1, buf_ysize=1)
    out_ds = None

    out_ds = gdal.GetDriverByName('GTiff').Create('tmp/vrtnull2.tif', 20, 10, 3, gdal.GDT_UInt16)
    out_ds.SetGeoTransform([2, 0.1, 0, 49, 0, -0.1])
    srs = osr.SpatialReference()
    srs.SetFromUserInput('EPSG:4326')
    out_ds.SetProjection(srs.ExportToWkt())
    out_ds.GetRasterBand(1).SetRasterColorInterpretation(gdal.GCI_RedBand)
    out_ds.GetRasterBand(2).SetRasterColorInterpretation(gdal.GCI_GreenBand)
    out_ds.GetRasterBand(3).SetRasterColorInterpretation(gdal.GCI_BlueBand)
    out_ds.GetRasterBand(1).SetNoDataValue(256)

    out_ds.GetRasterBand(1).WriteRaster(10, 0, 10, 10, '\x00', buf_type=gdal.GDT_Byte, buf_xsize=1, buf_ysize=1)
    out_ds.GetRasterBand(2).WriteRaster(10, 0, 10, 10, ff, buf_type=gdal.GDT_Byte, buf_xsize=1, buf_ysize=1)
    out_ds.GetRasterBand(3).WriteRaster(10, 0, 10, 10, '\x00', buf_type=gdal.GDT_Byte, buf_xsize=1, buf_ysize=1)
    out_ds = None

    gdaltest.runexternal(test_cli_utilities.get_gdalbuildvrt_path() + ' tmp/gdalbuildvrt7.vrt tmp/vrtnull1.tif tmp/vrtnull2.tif')

    ds = gdal.Open('tmp/gdalbuildvrt7.vrt')

    if ds.GetRasterBand(1).Checksum() != 1217:
        gdaltest.post_reason('Wrong checksum')
        return 'fail'

    if ds.GetRasterBand(2).Checksum() != 1218:
        gdaltest.post_reason('Wrong checksum')
        return 'fail'

    if ds.GetRasterBand(3).Checksum() != 0:
        gdaltest.post_reason('Wrong checksum')
        return 'fail'

    ds = None

    return 'success'
开发者ID:ksshannon,项目名称:gdal,代码行数:58,代码来源:test_gdalbuildvrt.py


示例13: test_gdalbuildvrt_13

def test_gdalbuildvrt_13():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return 'skip'

    gdaltest.runexternal(test_cli_utilities.get_gdalbuildvrt_path() + ' tmp/gdalbuildvrt13.vrt ../gcore/data/byte.tif -a_srs EPSG:4326')

    ds = gdal.Open('tmp/gdalbuildvrt13.vrt')
    if ds.GetProjectionRef().find('4326') == -1:
        return 'fail'
    ds = None

    return 'success'
开发者ID:nextgis-borsch,项目名称:tests,代码行数:12,代码来源:test_gdalbuildvrt.py


示例14: test_gdalbuildvrt_3

def test_gdalbuildvrt_3():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return "skip"

    open("tmp/filelist.txt", "wt").write(
        "tmp/gdalbuildvrt1.tif\ntmp/gdalbuildvrt2.tif\ntmp/gdalbuildvrt3.tif\ntmp/gdalbuildvrt4.tif"
    )

    gdaltest.runexternal(
        test_cli_utilities.get_gdalbuildvrt_path() + " -input_file_list tmp/filelist.txt tmp/mosaic.vrt"
    )

    return test_gdalbuildvrt_check()
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:13,代码来源:test_gdalbuildvrt.py


示例15: test_gdalbuildvrt_13

def test_gdalbuildvrt_13():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return "skip"

    gdaltest.runexternal(
        test_cli_utilities.get_gdalbuildvrt_path() + " tmp/gdalbuildvrt13.vrt ../gcore/data/byte.tif -a_srs EPSG:4326"
    )

    ds = gdal.Open("tmp/gdalbuildvrt13.vrt")
    if ds.GetProjectionRef().find("4326") == -1:
        return "fail"
    ds = None

    return "success"
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:14,代码来源:test_gdalbuildvrt.py


示例16: test_gdalbuildvrt_15

def test_gdalbuildvrt_15():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return 'skip'

    gdaltest.runexternal(test_cli_utilities.get_gdalbuildvrt_path() + ' tmp/test_gdalbuildvrt_15.vrt ../gcore/data/byte.tif -b 1')

    ds = gdal.Open('tmp/test_gdalbuildvrt_15.vrt')
    cs = ds.GetRasterBand(1).Checksum()
    ds = None

    if cs != 4672:
        gdaltest.post_reason('fail')
        print(cs)
        return 'fail'

    return 'success'
开发者ID:nextgis-borsch,项目名称:tests,代码行数:16,代码来源:test_gdalbuildvrt.py


示例17: test_gdalbuildvrt_cleanup

def test_gdalbuildvrt_cleanup():

    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return 'skip'

    ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/tileindex.shp')

    gdal.GetDriverByName('VRT').Delete('tmp/mosaic.vrt')
    gdal.GetDriverByName('VRT').Delete('tmp/mosaic2.vrt')
    gdal.GetDriverByName('VRT').Delete('tmp/stacked.vrt')
    gdal.GetDriverByName('VRT').Delete('tmp/gdalbuildvrt7.vrt')
    gdal.GetDriverByName('VRT').Delete('tmp/gdalbuildvrt10.vrt')
    gdal.GetDriverByName('VRT').Delete('tmp/gdalbuildvrt11.vrt')
    gdal.GetDriverByName('VRT').Delete('tmp/gdalbuildvrt12.vrt')
    gdal.GetDriverByName('VRT').Delete('tmp/gdalbuildvrt13.vrt')

    drv = gdal.GetDriverByName('GTiff')

    drv.Delete('tmp/gdalbuildvrt1.tif')
    drv.Delete('tmp/gdalbuildvrt2.tif')
    drv.Delete('tmp/gdalbuildvrt3.tif')
    drv.Delete('tmp/gdalbuildvrt4.tif')
    drv.Delete('tmp/gdalbuildvrt5.tif')
    drv.Delete('tmp/vrtnull1.tif')
    drv.Delete('tmp/vrtnull2.tif')
    drv.Delete('tmp/test_gdalbuildvrt_10_1.tif')
    drv.Delete('tmp/test_gdalbuildvrt_10_2.tif')
    drv.Delete('tmp/test_gdalbuildvrt_11_1.tif')
    drv.Delete('tmp/test_gdalbuildvrt_11_2.tif')
    try:
        os.remove('tmp/filelist.txt')
    except:
        pass

    return 'success'
开发者ID:afarnham,项目名称:gdal,代码行数:35,代码来源:test_gdalbuildvrt.py


示例18: test_gdalbuildvrt_4

def test_gdalbuildvrt_4():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return "skip"

    drv = gdal.GetDriverByName("GTiff")
    wkt = 'GEOGCS["WGS 72",DATUM["WGS_1972"]]'

    ds = drv.Create("tmp/gdalbuildvrt5.tif", 10, 10, 1)
    ds.SetProjection(wkt)
    ds.SetGeoTransform([47, 0.1, 0, 2, 0, -0.1])
    ds = None

    gdaltest.runexternal(
        test_cli_utilities.get_gdalbuildvrt_path()
        + " tmp/mosaic.vrt tmp/gdalbuildvrt1.tif tmp/gdalbuildvrt2.tif tmp/gdalbuildvrt3.tif tmp/gdalbuildvrt4.tif tmp/gdalbuildvrt5.tif"
    )

    return test_gdalbuildvrt_check()
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:18,代码来源:test_gdalbuildvrt.py


示例19: test_gdalbuildvrt_1

def test_gdalbuildvrt_1():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        return "skip"

    drv = gdal.GetDriverByName("GTiff")
    srs = osr.SpatialReference()
    srs.SetWellKnownGeogCS("WGS84")
    wkt = srs.ExportToWkt()

    ds = drv.Create("tmp/gdalbuildvrt1.tif", 10, 10, 1)
    ds.SetProjection(wkt)
    ds.SetGeoTransform([2, 0.1, 0, 49, 0, -0.1])
    ds.GetRasterBand(1).Fill(0)
    ds = None

    ds = drv.Create("tmp/gdalbuildvrt2.tif", 10, 10, 1)
    ds.SetProjection(wkt)
    ds.SetGeoTransform([3, 0.1, 0, 49, 0, -0.1])
    ds.GetRasterBand(1).Fill(63)
    ds = None

    ds = drv.Create("tmp/gdalbuildvrt3.tif", 10, 10, 1)
    ds.SetProjection(wkt)
    ds.SetGeoTransform([2, 0.1, 0, 48, 0, -0.1])
    ds.GetRasterBand(1).Fill(127)
    ds = None

    ds = drv.Create("tmp/gdalbuildvrt4.tif", 10, 10, 1)
    ds.SetProjection(wkt)
    ds.SetGeoTransform([3, 0.1, 0, 48, 0, -0.1])
    ds.GetRasterBand(1).Fill(255)
    ds = None

    (out, err) = gdaltest.runexternal_out_and_err(
        test_cli_utilities.get_gdalbuildvrt_path()
        + " tmp/mosaic.vrt tmp/gdalbuildvrt1.tif tmp/gdalbuildvrt2.tif tmp/gdalbuildvrt3.tif tmp/gdalbuildvrt4.tif"
    )
    if not (err is None or err == ""):
        gdaltest.post_reason("got error/warning")
        print(err)
        return "fail"

    return test_gdalbuildvrt_check()
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:43,代码来源:test_gdalbuildvrt.py


示例20: test_gdalbuildvrt_4

def test_gdalbuildvrt_4():
    if test_cli_utilities.get_gdalbuildvrt_path() is None:
        pytest.skip()

    drv = gdal.GetDriverByName('GTiff')
    wkt = """GEOGCS["WGS 72",
    DATUM["WGS_1972",
        SPHEROID["WGS 72",6378135,298.26],
        TOWGS84[0,0,4.5,0,0,0.554,0.2263]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]"""

    ds = drv.Create('tmp/gdalbuildvrt5.tif', 10, 10, 1)
    ds.SetProjection(wkt)
    ds.SetGeoTransform([47, 0.1, 0, 2, 0, -0.1])
    ds = None

    gdaltest.runexternal(test_cli_utilities.get_gdalbuildvrt_path() + ' tmp/mosaic.vrt tmp/gdalbuildvrt1.tif tmp/gdalbuildvrt2.tif tmp/gdalbuildvrt3.tif tmp/gdalbuildvrt4.tif tmp/gdalbuildvrt5.tif')

    return gdalbuildvrt_check()
开发者ID:AsgerPetersen,项目名称:gdal,代码行数:20,代码来源:test_gdalbuildvrt.py



注:本文中的test_cli_utilities.get_gdalbuildvrt_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap