示例#1
0
def test_gdal_ls_py_8():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName( 'HTTP' )
    except:
        drv = None

    if drv is None:
        return 'skip'

    f = gdal.VSIFOpenL('/vsicurl/http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.zip', 'rb')
    if f is None:
        return 'skip'
    gdal.VSIFCloseL(f)

    (ret, ret_str) = run_gdal_ls(['', '-l', '-R', '-Rzip', 'ftp://ftp.remotesensing.org/gdal/data/aig'])

    if ret != 'success':
        return ret

    if ret_str.find('-r--r--r--  1 unknown unknown        24576 2007-03-29 00:00 /vsicurl/ftp://ftp.remotesensing.org/gdal/data/aig/nzdem/info/arc0002r.001') == -1:
        print(ret_str)
        return 'fail'

    if ret_str.find('-r--r--r--  1 unknown unknown        24576 2007-03-29 12:20 /vsizip//vsicurl/ftp://ftp.remotesensing.org/gdal/data/aig/nzdem.zip/nzdem/info/arc0002r.001') == -1:
        print(ret_str)
        return 'fail'

    return 'success'
示例#2
0
def vsicurl_11():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName('HTTP')
    except:
        drv = None

    if drv is None:
        return 'skip'

    f = gdal.VSIFOpenL(
        '/vsicurl/http://download.osgeo.org/gdal/data/bmp/Bug2236.bmp', 'rb')
    if f is None:
        return 'skip'
    gdal.VSIFSeekL(f, 1000000, 0)
    gdal.VSIFReadL(1, 1, f)
    gdal.VSIFCloseL(f)

    filelist = gdal.ReadDir(
        '/vsicurl/http://download.osgeo.org/gdal/data/gtiff')
    if filelist is None or len(filelist) == 0:
        return 'fail'

    return 'success'
示例#3
0
def test_vsizip_create_zip64_stream_larger_than_4G():

    if not gdaltest.run_slow_tests():
        pytest.skip()

    zip_name = 'tmp/vsizip_create_zip64_stream_larger_than_4G.zip'

    gdal.Unlink(zip_name)

    niters = 999
    s = ''.join([chr(random.randint(0, 127)) for i in range(5 * 1000 * 1000)])
    with gdaltest.config_options({'GDAL_NUM_THREADS': 'ALL_CPUS'}):
        f = gdal.VSIFOpenL('/vsizip/' + zip_name + '/test2', 'wb')
        for i in range(niters):
            gdal.VSIFWriteL(s, 1, len(s), f)
        gdal.VSIFCloseL(f)

    size = gdal.VSIStatL(zip_name).size
    assert size > 0xFFFFFFFF

    size = gdal.VSIStatL('/vsizip/' + zip_name + '/test2').size
    assert size == len(s) * niters

    f = gdal.VSIFOpenL('/vsizip/' + zip_name + '/test2', 'rb')
    data = gdal.VSIFReadL(1, len(s), f).decode('ascii')
    gdal.VSIFCloseL(f)
    assert data == s

    gdal.Unlink(zip_name)
示例#4
0
def test_vsizip_create_zip64_stream_larger_than_4G():

    if not gdaltest.run_slow_tests():
        pytest.skip()

    zip_name = 'tmp/vsizip_create_zip64_stream_larger_than_4G.zip'

    gdal.Unlink(zip_name)

    niters = 999
    s = ''.join([chr(random.randint(0, 127)) for i in range(5 * 1000 * 1000)])
    with gdaltest.config_options({'GDAL_NUM_THREADS': 'ALL_CPUS'}):
        f = gdal.VSIFOpenL('/vsizip/' + zip_name + '/test2', 'wb')
        for i in range(niters):
            gdal.VSIFWriteL(s, 1, len(s), f)
        gdal.VSIFCloseL(f)

    size = gdal.VSIStatL(zip_name).size
    assert size > 0xFFFFFFFF

    size = gdal.VSIStatL('/vsizip/' + zip_name + '/test2').size
    assert size == len(s) * niters

    f = gdal.VSIFOpenL('/vsizip/' + zip_name + '/test2', 'rb')
    data = gdal.VSIFReadL(1, len(s), f).decode('ascii')
    gdal.VSIFCloseL(f)
    assert data == s

    gdal.Unlink(zip_name)
示例#5
0
def test_vsizip_create_zip64():

    if not gdaltest.run_slow_tests():
        pytest.skip()

    niters = 1000
    s = 'hello' * 1000 * 1000
    zip_name = '/vsimem/vsizip_create_zip64.zip'
    with gdaltest.config_options({'GDAL_NUM_THREADS': 'ALL_CPUS'}):
        fmain = gdal.VSIFOpenL('/vsizip/' + zip_name, 'wb')
        f = gdal.VSIFOpenL('/vsizip/' + zip_name + '/test', 'wb')
        for i in range(niters):
            gdal.VSIFWriteL(s, 1, len(s), f)
        gdal.VSIFCloseL(f)
        gdal.VSIFCloseL(fmain)

    size = gdal.VSIStatL(zip_name).size
    assert size <= 0xFFFFFFFF

    size = gdal.VSIStatL('/vsizip/' + zip_name + '/test').size
    assert size == len(s) * niters

    f = gdal.VSIFOpenL('/vsizip/' + zip_name + '/test', 'rb')
    data = gdal.VSIFReadL(1, len(s), f).decode('ascii')
    gdal.VSIFCloseL(f)
    assert data == s

    gdal.Unlink(zip_name)
示例#6
0
def test_gdal_ls_py_8():
    if not gdaltest.run_slow_tests():
        return 'skip'

    drv = gdal.GetDriverByName('HTTP')
    if drv is None:
        return 'skip'

    if int(gdal.VersionInfo('VERSION_NUM')) < 1900:
        gdaltest.post_reason('would stall for a long time')
        return 'skip'

    f = gdal.VSIFOpenL('/vsicurl/https://raw.githubusercontent.com/OSGeo/gdal/master/autotest/ogr/data/poly.zip', 'rb')
    if f is None:
        return 'skip'
    d = gdal.VSIFReadL(1, 1, f)
    gdal.VSIFCloseL(f)
    if not d:
        return 'skip'

    ret, ret_str = run_gdal_ls(['', '-l', '-R', '-Rzip', 'ftp://download.osgeo.org/gdal/data/aig'])

    if ret != 'success':
        return ret

    if ret_str.find('-r--r--r--  1 unknown unknown        24576 2007-03-29 00:00 /vsicurl/ftp://download.osgeo.org/gdal/data/aig/nzdem/info/arc0002r.001') == -1:
        print(ret_str)
        return 'fail'

    if ret_str.find('-r--r--r--  1 unknown unknown        24576 2007-03-29 12:20 /vsizip//vsicurl/ftp://download.osgeo.org/gdal/data/aig/nzdem.zip/nzdem/info/arc0002r.001') == -1:
        print(ret_str)
        return 'fail'

    return 'success'
示例#7
0
def test_gdal_ls_py_8():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    drv = gdal.GetDriverByName('HTTP')
    if drv is None:
        pytest.skip()

    if int(gdal.VersionInfo('VERSION_NUM')) < 1900:
        pytest.skip('would stall for a long time')

    f = gdal.VSIFOpenL(
        '/vsicurl/https://raw.githubusercontent.com/OSGeo/gdal/release/3.1/autotest/ogr/data/poly.zip',
        'rb')
    if f is None:
        pytest.skip()
    d = gdal.VSIFReadL(1, 1, f)
    gdal.VSIFCloseL(f)
    if not d:
        pytest.skip()

    ret_str = run_gdal_ls(
        ['', '-l', '-R', '-Rzip', 'ftp://download.osgeo.org/gdal/data/aig'])

    assert ret_str.find(
        '-r--r--r--  1 unknown unknown        24576 2007-03-29 00:00 /vsicurl/ftp://download.osgeo.org/gdal/data/aig/nzdem/info/arc0002r.001'
    ) != -1

    assert ret_str.find(
        '-r--r--r--  1 unknown unknown        24576 2007-03-29 12:20 /vsizip//vsicurl/ftp://download.osgeo.org/gdal/data/aig/nzdem.zip/nzdem/info/arc0002r.001'
    ) != -1
示例#8
0
def test_vsizip_create_zip64():

    if not gdaltest.run_slow_tests():
        pytest.skip()

    niters = 1000
    s = 'hello' * 1000 * 1000
    zip_name = '/vsimem/vsizip_create_zip64.zip'
    with gdaltest.config_options({'GDAL_NUM_THREADS': 'ALL_CPUS'}):
        fmain = gdal.VSIFOpenL('/vsizip/' + zip_name, 'wb')
        f = gdal.VSIFOpenL('/vsizip/' + zip_name + '/test', 'wb')
        for i in range(niters):
            gdal.VSIFWriteL(s, 1, len(s), f)
        gdal.VSIFCloseL(f)
        gdal.VSIFCloseL(fmain)

    size = gdal.VSIStatL(zip_name).size
    assert size <= 0xFFFFFFFF

    size = gdal.VSIStatL('/vsizip/' + zip_name + '/test').size
    assert size == len(s) * niters

    f = gdal.VSIFOpenL('/vsizip/' + zip_name + '/test', 'rb')
    data = gdal.VSIFReadL(1, len(s), f).decode('ascii')
    gdal.VSIFCloseL(f)
    assert data == s

    gdal.Unlink(zip_name)
示例#9
0
def test_vsicurl_4():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = ogr.Open('/vsizip/vsicurl/http://lelserver.env.duke.edu:8080/LandscapeTools/export/49/Downloads/1_Habitats.zip')
    assert ds is None
示例#10
0
def vsicurl_3():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = ogr.Open('/vsizip/vsicurl/http://www.iucnredlist.org/spatial-data/MAMMALS_TERRESTRIAL.zip')
    assert ds is None
示例#11
0
def vsicurl_2():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = gdal.Open('/vsizip//vsicurl/http://eros.usgs.gov/archive/nslrsda/GeoTowns/HongKong/srtm/n22e113.zip/n22e113.bil')
    assert ds is not None
示例#12
0
def test_vsicurl_1():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = ogr.Open('/vsizip/vsicurl/http://publicfiles.dep.state.fl.us/dear/BWR_GIS/2007NWFLULC/NWFWMD2007LULC.zip')
    assert ds is not None
示例#13
0
def test_vsicurl_10():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = gdal.Open('/vsicurl/http://download.osgeo.org/gdal/data/gtiff/xx%E4%B8%AD%E6%96%87.%E4%B8%AD%E6%96%87')
    assert ds is not None
示例#14
0
def test_vsicurl_5():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = gdal.Open('/vsicurl/http://dds.cr.usgs.gov/srtm/SRTM_image_sample/picture%20examples/N34W119_DEM.tif')
    assert ds is not None
示例#15
0
def test_vsicurl_7():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    fl = gdal.ReadDir('/vsicurl/http://ortho.linz.govt.nz/tifs/2005_06')
    assert fl
示例#16
0
文件: vsicurl.py 项目: venabled/gdal
def vsicurl_3():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = ogr.Open('/vsizip/vsicurl/http://www.iucnredlist.org/spatial-data/MAMMALS_TERRESTRIAL.zip')
    assert ds is None
示例#17
0
文件: vsicurl.py 项目: venabled/gdal
def test_vsicurl_4():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = ogr.Open('/vsizip/vsicurl/http://lelserver.env.duke.edu:8080/LandscapeTools/export/49/Downloads/1_Habitats.zip')
    assert ds is None
示例#18
0
文件: vsicurl.py 项目: venabled/gdal
def test_vsicurl_1():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = ogr.Open('/vsizip/vsicurl/http://publicfiles.dep.state.fl.us/dear/BWR_GIS/2007NWFLULC/NWFWMD2007LULC.zip')
    assert ds is not None
示例#19
0
文件: vsicurl.py 项目: venabled/gdal
def vsicurl_2():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = gdal.Open('/vsizip//vsicurl/http://eros.usgs.gov/archive/nslrsda/GeoTowns/HongKong/srtm/n22e113.zip/n22e113.bil')
    assert ds is not None
示例#20
0
文件: vsicurl.py 项目: venabled/gdal
def test_vsicurl_10():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = gdal.Open('/vsicurl/http://download.osgeo.org/gdal/data/gtiff/xx%E4%B8%AD%E6%96%87.%E4%B8%AD%E6%96%87')
    assert ds is not None
示例#21
0
文件: vsicurl.py 项目: venabled/gdal
def vsicurl_6_disabled():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    fl = gdal.ReadDir('/vsicurl/ftp://ftp2.cits.rncan.gc.ca/pub/cantopo/250k_tif')
    assert fl
示例#22
0
def test_vsicurl_7():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    fl = gdal.ReadDir('/vsicurl/http://ortho.linz.govt.nz/tifs/2005_06')
    assert fl
示例#23
0
文件: vsicurl.py 项目: venabled/gdal
def test_vsicurl_5():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = gdal.Open('/vsicurl/http://dds.cr.usgs.gov/srtm/SRTM_image_sample/picture%20examples/N34W119_DEM.tif')
    assert ds is not None
示例#24
0
def vsicurl_6_disabled():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    fl = gdal.ReadDir('/vsicurl/ftp://ftp2.cits.rncan.gc.ca/pub/cantopo/250k_tif')
    assert fl
示例#25
0
def test_vsicurl_9():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds = gdal.Open('/vsicurl/http://download.osgeo.org/gdal/data/gtiff/'
                   'xx\u4E2D\u6587.\u4E2D\u6587')
    assert ds is not None
示例#26
0
def vsicurl_8():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds1 = gdal.Open('/vsigzip//vsicurl/http://dds.cr.usgs.gov/pub/data/DEM/250/notavail/C/chipicoten-w.gz')
    gdal.Open('/vsizip//vsicurl/http://edcftp.cr.usgs.gov/pub/data/landcover/files/2009/biso/gokn09b_dnbr.zip/nps-serotnbsp-9001-20090321_rd.tif')
    cs = ds1.GetRasterBand(1).Checksum()
    assert cs == 61342
示例#27
0
文件: vsicurl.py 项目: venabled/gdal
def vsicurl_8():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    ds1 = gdal.Open('/vsigzip//vsicurl/http://dds.cr.usgs.gov/pub/data/DEM/250/notavail/C/chipicoten-w.gz')
    gdal.Open('/vsizip//vsicurl/http://edcftp.cr.usgs.gov/pub/data/landcover/files/2009/biso/gokn09b_dnbr.zip/nps-serotnbsp-9001-20090321_rd.tif')
    cs = ds1.GetRasterBand(1).Checksum()
    assert cs == 61342
示例#28
0
def vsicurl_7():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    fl = gdal.ReadDir('/vsicurl/http://ortho.linz.govt.nz/tifs/2005_06')
    if len(fl) == 0:
        return 'fail'

    return 'success'
示例#29
0
def vsicurl_4():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    ds = ogr.Open('/vsizip/vsicurl/http://lelserver.env.duke.edu:8080/LandscapeTools/export/49/Downloads/1_Habitats.zip')
    if ds is not None:
        return 'fail'

    return 'success'
示例#30
0
def vsicurl_6():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    fl = gdal.ReadDir('/vsicurl/ftp://ftp2.cits.rncan.gc.ca/pub/cantopo/250k_tif')
    if len(fl) == 0:
        return 'fail'

    return 'success'
示例#31
0
def vsicurl_2():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    ds = gdal.Open('/vsizip//vsicurl/http://eros.usgs.gov/archive/nslrsda/GeoTowns/HongKong/srtm/n22e113.zip/n22e113.bil')
    if ds is None:
        return 'fail'

    return 'success'
示例#32
0
文件: vsicurl.py 项目: sgillies/gdal
def vsicurl_2():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    ds = gdal.Open('/vsizip//vsicurl/http://eros.usgs.gov/archive/nslrsda/GeoTowns/HongKong/srtm/n22e113.zip/n22e113.bil')
    if ds is None:
        return 'fail'

    return 'success'
示例#33
0
文件: vsicurl.py 项目: sgillies/gdal
def vsicurl_10():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    ds = gdal.Open('/vsicurl/http://download.osgeo.org/gdal/data/gtiff/xx%E4%B8%AD%E6%96%87.%E4%B8%AD%E6%96%87')
    if ds is None:
        return 'fail'

    return 'success'
示例#34
0
文件: vsicurl.py 项目: sgillies/gdal
def vsicurl_1():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    ds = ogr.Open('/vsizip/vsicurl/http://publicfiles.dep.state.fl.us/dear/BWR_GIS/2007NWFLULC/NWFWMD2007LULC.zip')
    if ds is None:
        return 'fail'

    return 'success'
示例#35
0
文件: vsicurl.py 项目: sgillies/gdal
def vsicurl_6_disabled():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    fl = gdal.ReadDir('/vsicurl/ftp://ftp2.cits.rncan.gc.ca/pub/cantopo/250k_tif')
    if not fl:
        return 'fail'

    return 'success'
示例#36
0
文件: vsicurl.py 项目: sgillies/gdal
def vsicurl_7():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    fl = gdal.ReadDir('/vsicurl/http://ortho.linz.govt.nz/tifs/2005_06')
    if not fl:
        return 'fail'

    return 'success'
示例#37
0
def vsicurl_5():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    ds = gdal.Open('/vsicurl/http://dds.cr.usgs.gov/srtm/SRTM_image_sample/picture%20examples/N34W119_DEM.tif')
    if ds is None:
        return 'fail'

    return 'success'
示例#38
0
文件: vsicurl.py 项目: sgillies/gdal
def vsicurl_5():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    ds = gdal.Open('/vsicurl/http://dds.cr.usgs.gov/srtm/SRTM_image_sample/picture%20examples/N34W119_DEM.tif')
    if ds is None:
        return 'fail'

    return 'success'
示例#39
0
def vsicurl_10():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    ds = gdal.Open('/vsicurl/http://download.osgeo.org/gdal/data/gtiff/xx%E4%B8%AD%E6%96%87.%E4%B8%AD%E6%96%87')
    if ds is None:
        return 'fail'

    return 'success'
示例#40
0
def vsicurl_3():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    ds = ogr.Open('/vsizip/vsicurl/http://www.iucnredlist.org/spatial-data/MAMMALS_TERRESTRIAL.zip')
    if ds is not None:
        return 'fail'

    return 'success'
示例#41
0
def vsicurl_1():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    ds = ogr.Open('/vsizip/vsicurl/http://publicfiles.dep.state.fl.us/dear/BWR_GIS/2007NWFLULC/NWFWMD2007LULC.zip')
    if ds is None:
        return 'fail'

    return 'success'
示例#42
0
文件: vsicurl.py 项目: sgillies/gdal
def vsicurl_4():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    ds = ogr.Open('/vsizip/vsicurl/http://lelserver.env.duke.edu:8080/LandscapeTools/export/49/Downloads/1_Habitats.zip')
    if ds is not None:
        return 'fail'

    return 'success'
示例#43
0
文件: vsicurl.py 项目: sgillies/gdal
def vsicurl_3():
    if not gdaltest.run_slow_tests():
        return 'skip'

    if not gdaltest.built_against_curl():
        return 'skip'

    ds = ogr.Open('/vsizip/vsicurl/http://www.iucnredlist.org/spatial-data/MAMMALS_TERRESTRIAL.zip')
    if ds is not None:
        return 'fail'

    return 'success'
示例#44
0
文件: vsicurl.py 项目: venabled/gdal
def test_vsicurl_9():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    if version_info >= (3, 0, 0):
        filename = 'xx\u4E2D\u6587.\u4E2D\u6587'
    else:
        exec("filename =  u'xx\u4E2D\u6587.\u4E2D\u6587'")
        filename = filename.encode('utf-8')

    ds = gdal.Open('/vsicurl/http://download.osgeo.org/gdal/data/gtiff/' + filename)
    assert ds is not None
示例#45
0
def test_vsicurl_9():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    if version_info >= (3, 0, 0):
        filename = 'xx\u4E2D\u6587.\u4E2D\u6587'
    else:
        exec("filename =  u'xx\u4E2D\u6587.\u4E2D\u6587'")
        filename = filename.encode('utf-8')

    ds = gdal.Open('/vsicurl/http://download.osgeo.org/gdal/data/gtiff/' + filename)
    assert ds is not None
示例#46
0
文件: netcdf.py 项目: ejnens/gdal
def netcdf_34():

    filename = 'utm-big-chunks.nc'
    # this timeout is more than enough - on my system takes <1s with fix, about 25 seconds without
    timeout = 5

    if gdaltest.netcdf_drv is None:
        return 'skip'

    if not gdaltest.netcdf_drv_has_nc4:
        return 'skip'

    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        from multiprocessing import Process
    except:
        print('from multiprocessing import Process failed')
        return 'skip'

    if not gdaltest.download_file(
            'http://download.osgeo.org/gdal/data/netcdf/' + filename,
            filename):
        return 'skip'

    sys.stdout.write('.')
    sys.stdout.flush()

    tst = gdaltest.GDALTest('NetCDF', '../tmp/cache/' + filename, 1, 31621)
    #tst.testOpen()

    gdal.PushErrorHandler('CPLQuietErrorHandler')
    proc = Process(target=tst.testOpen)
    proc.start()
    proc.join(timeout)
    gdal.PopErrorHandler()

    # if proc is alive after timeout we must terminate it, and return fail
    # valgrind detects memory leaks when this occurs (although it should never happen)
    if proc.is_alive():
        proc.terminate()
        print(
            'testOpen() for file %s has reached timeout limit of %d seconds' %
            (filename, timeout))
        return 'fail'

    return 'success'
示例#47
0
文件: vsicurl.py 项目: venabled/gdal
def test_vsicurl_11():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    f = gdal.VSIFOpenL('/vsicurl/http://download.osgeo.org/gdal/data/bmp/Bug2236.bmp', 'rb')
    if f is None:
        pytest.skip()
    gdal.VSIFSeekL(f, 1000000, 0)
    gdal.VSIFReadL(1, 1, f)
    gdal.VSIFCloseL(f)

    filelist = gdal.ReadDir('/vsicurl/http://download.osgeo.org/gdal/data/gtiff')
    assert filelist is not None and filelist
示例#48
0
def test_vsicurl_11():
    if not gdaltest.run_slow_tests():
        pytest.skip()

    if not gdaltest.built_against_curl():
        pytest.skip()

    f = gdal.VSIFOpenL('/vsicurl/http://download.osgeo.org/gdal/data/bmp/Bug2236.bmp', 'rb')
    if f is None:
        pytest.skip()
    gdal.VSIFSeekL(f, 1000000, 0)
    gdal.VSIFReadL(1, 1, f)
    gdal.VSIFCloseL(f)

    filelist = gdal.ReadDir('/vsicurl/http://download.osgeo.org/gdal/data/gtiff')
    assert filelist is not None and filelist
示例#49
0
def vsicurl_10():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName( 'HTTP' )
    except:
        drv = None

    if drv is None:
        return 'skip'

    ds = gdal.Open('/vsicurl/http://download.osgeo.org/gdal/data/gtiff/xx%E4%B8%AD%E6%96%87.%E4%B8%AD%E6%96%87')
    if ds is None:
        return 'fail'

    return 'success'
示例#50
0
def vsicurl_7():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName('HTTP')
    except:
        drv = None

    if drv is None:
        return 'skip'

    fl = gdal.ReadDir('/vsicurl/http://ortho.linz.govt.nz/tifs/2005_06')
    if len(fl) == 0:
        return 'fail'

    return 'success'
示例#51
0
def vsicurl_2():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName( 'HTTP' )
    except:
        drv = None

    if drv is None:
        return 'skip'

    ds = gdal.Open('/vsizip//vsicurl/http://eros.usgs.gov/archive/nslrsda/GeoTowns/HongKong/srtm/n22e113.zip/n22e113.bil')
    if ds is None:
        return 'fail'

    return 'success'
示例#52
0
def vsicurl_3():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName( 'HTTP' )
    except:
        drv = None

    if drv is None:
        return 'skip'

    ds = ogr.Open('/vsizip/vsicurl/http://www.iucnredlist.org/spatial-data/MAMMALS_TERRESTRIAL.zip')
    if ds is not None:
        return 'fail'

    return 'success'
示例#53
0
def vsicurl_3():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName( 'HTTP' )
    except:
        drv = None

    if drv is None:
        return 'skip'

    ds = ogr.Open('/vsizip/vsicurl/http://www.iucnredlist.org/spatial-data/MAMMALS_TERRESTRIAL.zip')
    if ds is not None:
        return 'fail'

    return 'success'
示例#54
0
def vsicurl_2():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName( 'HTTP' )
    except:
        drv = None

    if drv is None:
        return 'skip'

    ds = gdal.Open('/vsizip//vsicurl/http://eros.usgs.gov/archive/nslrsda/GeoTowns/HongKong/srtm/n22e113.zip/n22e113.bil')
    if ds is None:
        return 'fail'

    return 'success'
示例#55
0
def vsicurl_1():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName( 'HTTP' )
    except:
        drv = None

    if drv is None:
        return 'skip'

    ds = ogr.Open('/vsizip/vsicurl/http://publicfiles.dep.state.fl.us/dear/BWR_GIS/2007NWFLULC/NWFWMD2007LULC.zip')
    if ds is None:
        return 'fail'

    return 'success'
示例#56
0
def vsicurl_10():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName( 'HTTP' )
    except:
        drv = None

    if drv is None:
        return 'skip'

    ds = gdal.Open('/vsicurl/http://download.osgeo.org/gdal/data/gtiff/xx%E4%B8%AD%E6%96%87.%E4%B8%AD%E6%96%87')
    if ds is None:
        return 'fail'

    return 'success'
示例#57
0
def vsicurl_7():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName( 'HTTP' )
    except:
        drv = None

    if drv is None:
        return 'skip'

    fl = gdal.ReadDir('/vsicurl/http://ortho.linz.govt.nz/tifs/2005_06')
    if len(fl) == 0:
        return 'fail'

    return 'success'
示例#58
0
def vsicurl_6():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName( 'HTTP' )
    except:
        drv = None

    if drv is None:
        return 'skip'

    fl = gdal.ReadDir('/vsicurl/ftp://ftp2.cits.rncan.gc.ca/pub/cantopo/250k_tif')
    if len(fl) == 0:
        return 'fail'

    return 'success'
示例#59
0
def vsicurl_5():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName( 'HTTP' )
    except:
        drv = None

    if drv is None:
        return 'skip'

    ds = gdal.Open('/vsicurl/http://dds.cr.usgs.gov/srtm/SRTM_image_sample/picture%20examples/N34W119_DEM.tif')
    if ds is None:
        return 'fail'

    return 'success'
示例#60
0
def vsicurl_1():
    if not gdaltest.run_slow_tests():
        return 'skip'

    try:
        drv = gdal.GetDriverByName( 'HTTP' )
    except:
        drv = None

    if drv is None:
        return 'skip'

    ds = ogr.Open('/vsizip/vsicurl/http://publicfiles.dep.state.fl.us/dear/BWR_GIS/2007NWFLULC/NWFWMD2007LULC.zip')
    if ds is None:
        return 'fail'

    return 'success'