예제 #1
0
def test_gdallocationinfo_3():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -b 1 -valonly ../gcore/data/byte.tif 0 0')
    expected_ret = """107"""
    assert ret.startswith(expected_ret)
예제 #2
0
def test_gdallocationinfo_3():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -b 1 -valonly ../gcore/data/byte.tif 0 0')
    expected_ret = """107"""
    assert ret.startswith(expected_ret)
예제 #3
0
def test_gdallocationinfo_6():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        return 'skip'

    src_ds = gdal.Open('../gcore/data/byte.tif')
    ds = gdal.GetDriverByName('GTiff').CreateCopy(
        'tmp/test_gdallocationinfo_6.tif', src_ds)
    ds.BuildOverviews('AVERAGE', overviewlist=[2])
    ds = None
    src_ds = None

    ret = gdaltest.runexternal(
        test_cli_utilities.get_gdallocationinfo_path() +
        ' tmp/test_gdallocationinfo_6.tif 10 10 -overview 1')

    gdal.GetDriverByName('GTiff').Delete('tmp/test_gdallocationinfo_6.tif')

    expected_ret = """Report:
  Location: (10P,10L)
  Band 1:
    Value: 130"""
    if ret.find(expected_ret) != 0:
        print(ret)
        return 'fail'

    return 'success'
예제 #4
0
def test_gdallocationinfo_wgs84():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -valonly -wgs84 ../gcore/data/byte.tif -117.6354747 33.8970515')

    expected_ret = """115"""
    assert expected_ret in ret
예제 #5
0
def test_gdallocationinfo_5():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -lifonly ../gcore/data/byte.vrt 0 0')
    expected_ret1 = """../gcore/data/byte.tif"""
    expected_ret2 = """../gcore/data\\byte.tif"""
    assert expected_ret1 in ret or expected_ret2 in ret
예제 #6
0
def test_gdallocationinfo_5():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -lifonly ../gcore/data/byte.vrt 0 0')
    expected_ret1 = """../gcore/data/byte.tif"""
    expected_ret2 = """../gcore/data\\byte.tif"""
    assert expected_ret1 in ret or expected_ret2 in ret
예제 #7
0
def test_gdallocationinfo_wgs84():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(
        test_cli_utilities.get_gdallocationinfo_path() +
        ' -valonly -wgs84 ../gcore/data/byte.tif -117.6354747 33.8970515')

    expected_ret = """115"""
    assert expected_ret in ret
예제 #8
0
def test_gdallocationinfo_3():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        return 'skip'

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -b 1 -valonly ../gcore/data/byte.tif 0 0')
    expected_ret = """107"""
    if ret.find(expected_ret) != 0:
        print(ret)
        return 'fail'

    return 'success'
예제 #9
0
def test_gdallocationinfo_4():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -geoloc ../gcore/data/byte.tif 440720.000 3751320.000')
    ret = ret.replace('\r\n', '\n')
    expected_ret = """Report:
  Location: (0P,0L)
  Band 1:
    Value: 107"""
    assert ret.startswith(expected_ret)
예제 #10
0
def test_gdallocationinfo_4():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -geoloc ../gcore/data/byte.tif 440720.000 3751320.000')
    ret = ret.replace('\r\n', '\n')
    expected_ret = """Report:
  Location: (0P,0L)
  Band 1:
    Value: 107"""
    assert ret.startswith(expected_ret)
예제 #11
0
def test_gdallocationinfo_2():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -xml ../gcore/data/byte.tif 0 0')
    ret = ret.replace('\r\n', '\n')
    expected_ret = """<Report pixel="0" line="0">
  <BandReport band="1">
    <Value>107</Value>
  </BandReport>
</Report>"""
    assert ret.startswith(expected_ret)
예제 #12
0
def test_gdallocationinfo_5():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        return 'skip'

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -lifonly ../gcore/data/byte.vrt 0 0')
    expected_ret1 = """../gcore/data/byte.tif"""
    expected_ret2 = """../gcore/data\\byte.tif"""
    if ret.find(expected_ret1) != 0 and ret.find(expected_ret2) != 0:
        print(ret)
        return 'fail'

    return 'success'
예제 #13
0
def test_gdallocationinfo_2():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -xml ../gcore/data/byte.tif 0 0')
    ret = ret.replace('\r\n', '\n')
    expected_ret = """<Report pixel="0" line="0">
  <BandReport band="1">
    <Value>107</Value>
  </BandReport>
</Report>"""
    assert ret.startswith(expected_ret)
예제 #14
0
def test_gdallocationinfo_1():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    (ret, err) = gdaltest.runexternal_out_and_err(test_cli_utilities.get_gdallocationinfo_path() + ' ../gcore/data/byte.tif 0 0')
    assert (err is None or err == ''), 'got error/warning'

    ret = ret.replace('\r\n', '\n')
    expected_ret = """Report:
  Location: (0P,0L)
  Band 1:
    Value: 107"""
    assert ret.startswith(expected_ret)
예제 #15
0
def test_gdallocationinfo_1():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    (ret, err) = gdaltest.runexternal_out_and_err(test_cli_utilities.get_gdallocationinfo_path() + ' ../gcore/data/byte.tif 0 0')
    assert (err is None or err == ''), 'got error/warning'

    ret = ret.replace('\r\n', '\n')
    expected_ret = """Report:
  Location: (0P,0L)
  Band 1:
    Value: 107"""
    assert ret.startswith(expected_ret)
예제 #16
0
def test_gdallocationinfo_4():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        return 'skip'

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -geoloc ../gcore/data/byte.tif 440720.000 3751320.000')
    ret = ret.replace('\r\n', '\n')
    expected_ret = """Report:
  Location: (0P,0L)
  Band 1:
    Value: 107"""
    if ret.find(expected_ret) != 0:
        print(ret)
        return 'fail'

    return 'success'
예제 #17
0
def test_gdallocationinfo_6():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    src_ds = gdal.Open('../gcore/data/byte.tif')
    ds = gdal.GetDriverByName('GTiff').CreateCopy('tmp/test_gdallocationinfo_6.tif', src_ds)
    ds.BuildOverviews('AVERAGE', overviewlist=[2])
    ds = None
    src_ds = None

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' tmp/test_gdallocationinfo_6.tif 10 10 -overview 1')

    gdal.GetDriverByName('GTiff').Delete('tmp/test_gdallocationinfo_6.tif')
    expected_ret = """Value: 130"""
    assert expected_ret in ret
예제 #18
0
def test_gdallocationinfo_6():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        pytest.skip()

    src_ds = gdal.Open('../gcore/data/byte.tif')
    ds = gdal.GetDriverByName('GTiff').CreateCopy('tmp/test_gdallocationinfo_6.tif', src_ds)
    ds.BuildOverviews('AVERAGE', overviewlist=[2])
    ds = None
    src_ds = None

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' tmp/test_gdallocationinfo_6.tif 10 10 -overview 1')

    gdal.GetDriverByName('GTiff').Delete('tmp/test_gdallocationinfo_6.tif')
    expected_ret = """Value: 130"""
    assert expected_ret in ret
예제 #19
0
def test_gdallocationinfo_2():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        return 'skip'

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' -xml ../gcore/data/byte.tif 0 0')
    ret = ret.replace('\r\n', '\n')
    expected_ret = """<Report pixel="0" line="0">
  <BandReport band="1">
    <Value>107</Value>
  </BandReport>
</Report>"""
    if ret.find(expected_ret) != 0:
        print(ret)
        return 'fail'

    return 'success'
예제 #20
0
def test_gdallocationinfo_6():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        return 'skip'

    src_ds = gdal.Open('../gcore/data/byte.tif')
    ds = gdal.GetDriverByName('GTiff').CreateCopy('tmp/test_gdallocationinfo_6.tif', src_ds)
    ds.BuildOverviews('AVERAGE', overviewlist=[2])
    ds = None
    src_ds = None

    ret = gdaltest.runexternal(test_cli_utilities.get_gdallocationinfo_path() + ' tmp/test_gdallocationinfo_6.tif 10 10 -overview 1')

    gdal.GetDriverByName('GTiff').Delete('tmp/test_gdallocationinfo_6.tif')
    expected_ret = """Value: 130"""
    if ret.find(expected_ret) < 0:
        print(ret)
        return 'fail'

    return 'success'
예제 #21
0
def test_gdallocationinfo_1():
    if test_cli_utilities.get_gdallocationinfo_path() is None:
        return 'skip'

    (ret, err) = gdaltest.runexternal_out_and_err(test_cli_utilities.get_gdallocationinfo_path() + ' ../gcore/data/byte.tif 0 0')
    if not (err is None or err == ''):
        gdaltest.post_reason('got error/warning')
        print(err)
        return 'fail'

    ret = ret.replace('\r\n', '\n')
    expected_ret = """Report:
  Location: (0P,0L)
  Band 1:
    Value: 107"""
    if ret.find(expected_ret) != 0:
        print(ret)
        return 'fail'

    return 'success'