Пример #1
0
def test_ogrlineref_1():
    if ogrtest.have_geos() is 0 or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'

    try:
        os.stat('tmp/parts.shp')
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/parts.shp')
    except:
        pass

    (ret, err) = gdaltest.runexternal_out_and_err(test_cli_utilities.get_ogrlineref_path() + ' -create -l data/path.shp -p data/mstones.shp -pm pos -o tmp/parts.shp -s 1000')
    if not (err is None or err == '') :
        gdaltest.post_reason('got error/warning')
        print(err)
        return 'fail'

    ds = ogr.Open('tmp/parts.shp')
    if ds is None or ds.GetLayer(0).GetFeatureCount() != 9:
        return 'fail'

    ds.Destroy()
    
#    ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/parts.shp')

    return 'success'
Пример #2
0
def test_ogrlineref_1():
    if ogrtest.have_geos() is 0 or test_cli_utilities.get_ogrlineref_path(
    ) is None:
        return 'skip'

    try:
        os.stat('tmp/parts.shp')
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/parts.shp')
    except:
        pass

    (ret, err) = gdaltest.runexternal_out_and_err(
        test_cli_utilities.get_ogrlineref_path() +
        ' -create -l data/path.shp -p data/mstones.shp -pm pos -o tmp/parts.shp -s 1000'
    )
    if not (err is None or err == ''):
        gdaltest.post_reason('got error/warning')
        print(err)
        return 'fail'

    ds = ogr.Open('tmp/parts.shp')
    if ds is None or ds.GetLayer(0).GetFeatureCount() != 9:
        return 'fail'

    ds.Destroy()

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

    return 'success'
Пример #3
0
def test_ogrlineref_4():
    if ogrtest.have_geos() is 0 or test_cli_utilities.get_ogrlineref_path(
    ) is None:
        return 'skip'

    try:
        os.stat('tmp/subline.shp')
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource(
            'tmp/subline.shp')
    except:
        pass

    gdaltest.runexternal(
        test_cli_utilities.get_ogrlineref_path() +
        ' -get_subline -r tmp/parts.shp -mb 13300 -me 17400 -o tmp/subline.shp'
    )

    ds = ogr.Open('tmp/subline.shp')
    if ds is None or ds.GetLayer(0).GetFeatureCount() != 1:
        return 'fail'
    ds.Destroy()

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

    return 'success'
Пример #4
0
def test_ogrlineref_4():
    if not ogrtest.have_geos(
    ) or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'

    if os.path.exists('tmp/subline.shp'):
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource(
            'tmp/subline.shp')

    gdaltest.runexternal(
        test_cli_utilities.get_ogrlineref_path() +
        ' -get_subline -r tmp/parts.shp -mb 13300 -me 17400 -o tmp/subline.shp'
    )

    ds = ogr.Open('tmp/subline.shp')
    if ds is None:
        gdaltest.post_reason('ds is None')
        return 'fail'

    feature_count = ds.GetLayer(0).GetFeatureCount()
    if feature_count != 1:
        gdaltest.post_reason('feature count %d != 1' % feature_count)
        return 'fail'
    ds = None

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

    return 'success'
Пример #5
0
def test_ogrlineref_2():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_pos -r tmp/parts.shp -x -1.4345 -y 51.9497 -quiet').strip()

    expected = '15977.724709'
    assert ret == expected, ('"%s" != %s' % (ret.strip(), expected))
Пример #6
0
def test_ogrlineref_3():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_coord -r tmp/parts.shp -m 15977.724709 -quiet').strip()

    expected = '-1.435097,51.950080,0.000000'
    assert ret == expected, ('%s != %s' % (ret.strip(), expected))
Пример #7
0
def test_ogrlineref_3():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_coord -r tmp/parts.shp -m 15977.724709 -quiet').strip()

    expected = '-1.435097,51.950080,0.000000'
    assert ret == expected, ('%s != %s' % (ret.strip(), expected))
Пример #8
0
def test_ogrlineref_2():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        pytest.skip()

    ret = gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_pos -r tmp/parts.shp -x -1.4345 -y 51.9497 -quiet').strip()

    expected = '15977.724709'
    assert ret == expected, ('"%s" != %s' % (ret.strip(), expected))
Пример #9
0
def test_ogrlineref_2():
    if ogrtest.have_geos() is 0 or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'

    ret = gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_pos -r tmp/parts.shp -x -1.4345 -y 51.9497 -quiet')

    if ret.strip() != "15984.938840":
        return 'fail'

    return 'success'
Пример #10
0
def test_ogrlineref_3():
    if ogrtest.have_geos() is 0 or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'
 
    ret = gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_coord -r tmp/parts.shp -m 15984.938840 -quiet')

    if ret.strip() != "-1.435097,51.950080,0.000000":
        return 'fail'
        
    return 'success'
Пример #11
0
def test_ogrlineref_5():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'

    if os.path.exists('tmp/parts.kml'):
        ogr.GetDriverByName('KML').DeleteDataSource('tmp/parts.kml')

    gdaltest.runexternal_out_and_err(test_cli_utilities.get_ogrlineref_path() + ' -create -f "KML" -l data/path.shp -p data/mstones.shp -pm pos -o tmp/parts.kml -s 222')
    if os.path.exists('tmp/parts.kml'):
        return 'success'

    return 'fail'
Пример #12
0
def test_ogrlineref_1():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        pytest.skip()

    if os.path.exists('tmp/parts.shp'):
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/parts.shp')

    _, err = gdaltest.runexternal_out_and_err(test_cli_utilities.get_ogrlineref_path() + ' -create -l data/path.shp -p data/mstones.shp -pm pos -o tmp/parts.shp -s 1000')
    assert err is None or err == '', ('got error/warning: "%s"' % err)

    ds = ogr.Open('tmp/parts.shp')
    assert ds is not None and ds.GetLayer(0).GetFeatureCount() == 9
Пример #13
0
def test_ogrlineref_2():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'

    ret = gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_pos -r tmp/parts.shp -x -1.4345 -y 51.9497 -quiet').strip()

    expected = '15977.724709'
    if ret != expected:
        gdaltest.post_reason('"%s" != %s' % (ret.strip(), expected))
        return 'fail'

    return 'success'
Пример #14
0
def test_ogrlineref_5():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        pytest.skip()

    if os.path.exists('tmp/parts.kml'):
        ogr.GetDriverByName('KML').DeleteDataSource('tmp/parts.kml')

    gdaltest.runexternal_out_and_err(test_cli_utilities.get_ogrlineref_path() + ' -create -f "KML" -l data/path.shp -p data/mstones.shp -pm pos -o tmp/parts.kml -s 222')
    if os.path.exists('tmp/parts.kml'):
        return

    pytest.fail()
Пример #15
0
def test_ogrlineref_3():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'

    ret = gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_coord -r tmp/parts.shp -m 15977.724709 -quiet').strip()

    expected = '-1.435097,51.950080,0.000000'
    if ret != expected:
        gdaltest.post_reason('%s != %s' % (ret.strip(), expected))
        return 'fail'

    return 'success'
Пример #16
0
def test_ogrlineref_3():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'

    ret = gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_coord -r tmp/parts.shp -m 15977.724709 -quiet').strip()

    expected = '-1.435097,51.950080,0.000000'
    if ret != expected:
        gdaltest.post_reason('%s != %s' % (ret.strip(), expected))
        return 'fail'

    return 'success'
Пример #17
0
def test_ogrlineref_1():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        pytest.skip()

    if os.path.exists('tmp/parts.shp'):
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/parts.shp')

    _, err = gdaltest.runexternal_out_and_err(test_cli_utilities.get_ogrlineref_path() + ' -create -l data/path.shp -p data/mstones.shp -pm pos -o tmp/parts.shp -s 1000')
    assert err is None or err == '', ('got error/warning: "%s"' % err)

    ds = ogr.Open('tmp/parts.shp')
    assert ds is not None and ds.GetLayer(0).GetFeatureCount() == 9
Пример #18
0
def test_ogrlineref_3():
    if ogrtest.have_geos() is 0 or test_cli_utilities.get_ogrlineref_path(
    ) is None:
        return 'skip'

    ret = gdaltest.runexternal(
        test_cli_utilities.get_ogrlineref_path() +
        ' -get_coord -r tmp/parts.shp -m 15977.724709 -quiet')

    if ret.strip() != "-1.435097,51.950080,0.000000":
        return 'fail'

    return 'success'
Пример #19
0
def test_ogrlineref_2():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'

    ret = gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_pos -r tmp/parts.shp -x -1.4345 -y 51.9497 -quiet').strip()

    expected = '15977.724709'
    if ret != expected:
        gdaltest.post_reason('"%s" != %s' % (ret.strip(), expected))
        print(ret)
        return 'fail'

    return 'success'
Пример #20
0
def test_ogrlineref_2():
    if ogrtest.have_geos() is 0 or test_cli_utilities.get_ogrlineref_path(
    ) is None:
        return 'skip'

    ret = gdaltest.runexternal(
        test_cli_utilities.get_ogrlineref_path() +
        ' -get_pos -r tmp/parts.shp -x -1.4345 -y 51.9497 -quiet')

    if ret.strip() != "15977.724709":
        return 'fail'

    return 'success'
Пример #21
0
def test_ogrlineref_1():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'

    if os.path.exists('tmp/parts.shp'):
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/parts.shp')

    ret, err = gdaltest.runexternal_out_and_err(test_cli_utilities.get_ogrlineref_path() + ' -create -l data/path.shp -p data/mstones.shp -pm pos -o tmp/parts.shp -s 1000')
    if err is not None and err != '':
        gdaltest.post_reason('got error/warning: "%s"' % err)
        return 'fail'

    ds = ogr.Open('tmp/parts.shp')
    if ds is None or ds.GetLayer(0).GetFeatureCount() != 9:
        return 'fail'

    return 'success'
Пример #22
0
def test_ogrlineref_4():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        pytest.skip()

    if os.path.exists('tmp/subline.shp'):
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/subline.shp')

    gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_subline -r tmp/parts.shp -mb 13300 -me 17400 -o tmp/subline.shp')

    ds = ogr.Open('tmp/subline.shp')
    assert ds is not None, 'ds is None'

    feature_count = ds.GetLayer(0).GetFeatureCount()
    assert feature_count == 1, ('feature count %d != 1' % feature_count)
    ds = None

    ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/subline.shp')
Пример #23
0
def test_ogrlineref_4():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        pytest.skip()

    if os.path.exists('tmp/subline.shp'):
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/subline.shp')

    gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_subline -r tmp/parts.shp -mb 13300 -me 17400 -o tmp/subline.shp')

    ds = ogr.Open('tmp/subline.shp')
    assert ds is not None, 'ds is None'

    feature_count = ds.GetLayer(0).GetFeatureCount()
    assert feature_count == 1, ('feature count %d != 1' % feature_count)
    ds = None

    ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/subline.shp')
Пример #24
0
def test_ogrlineref_cleanup():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        pytest.skip()

    if os.path.exists('tmp/parts.shp'):
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/parts.shp')
    if os.path.exists('tmp/parts.kml'):
        ogr.GetDriverByName('KML').DeleteDataSource('tmp/parts.kml')
Пример #25
0
def test_ogrlineref_cleanup():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        pytest.skip()

    if os.path.exists('tmp/parts.shp'):
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/parts.shp')
    if os.path.exists('tmp/parts.kml'):
        ogr.GetDriverByName('KML').DeleteDataSource('tmp/parts.kml')
Пример #26
0
def test_ogrlineref_1():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'

    if os.path.exists('tmp/parts.shp'):
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/parts.shp')

    ret, err = gdaltest.runexternal_out_and_err(test_cli_utilities.get_ogrlineref_path() + ' -create -l data/path.shp -p data/mstones.shp -pm pos -o tmp/parts.shp -s 1000')
    if err is not None and err != '':
        gdaltest.post_reason('got error/warning: "%s"' % err)
        return 'fail'

    ds = ogr.Open('tmp/parts.shp')
    if ds is None or ds.GetLayer(0).GetFeatureCount() != 9:
        return 'fail'

    return 'success'
Пример #27
0
def test_ogrlineref_cleanup():
    if ogrtest.have_geos() is 0 or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'
    try:
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/parts.shp')
    except:
        pass
    return 'success'    
Пример #28
0
def test_ogrlineref_cleanup():
    if ogrtest.have_geos() is 0 or test_cli_utilities.get_ogrlineref_path(
    ) is None:
        return 'skip'
    try:
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/parts.shp')
    except:
        pass
    return 'success'
Пример #29
0
def test_ogrlineref_4():
    if ogrtest.have_geos() is 0 or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'

    try:
        os.stat('tmp/subline.shp')
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/subline.shp')
    except:
        pass

    gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_subline -r tmp/parts.shp -mb 13300 -me 17400 -o tmp/subline.shp')
    
    ds = ogr.Open('tmp/subline.shp')
    if ds is None or ds.GetLayer(0).GetFeatureCount() != 1:
        return 'fail'
    ds.Destroy()

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

    return 'success'
Пример #30
0
def test_ogrlineref_4():
    if not ogrtest.have_geos() or test_cli_utilities.get_ogrlineref_path() is None:
        return 'skip'

    if os.path.exists('tmp/subline.shp'):
        ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/subline.shp')

    gdaltest.runexternal(test_cli_utilities.get_ogrlineref_path() + ' -get_subline -r tmp/parts.shp -mb 13300 -me 17400 -o tmp/subline.shp')

    ds = ogr.Open('tmp/subline.shp')
    if ds is None:
        gdaltest.post_reason('ds is None')
        return 'fail'

    feature_count = ds.GetLayer(0).GetFeatureCount()
    if feature_count != 1:
        gdaltest.post_reason('feature count %d != 1' % feature_count)
        return 'fail'
    ds = None

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

    return 'success'