How to use the fiona.fio.main.main_group function in fiona

To help you get started, we’ve selected a few fiona examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Toblerity / Fiona / tests / test_fio_bounds.py View on Github external
def test_with_obj(feature_seq, runner):
    result = runner.invoke(main_group, ['bounds', '--with-obj'], feature_seq)
    assert result.exit_code == 0
    assert result.output.count('geometry') == result.output.count('bbox') == 2
github Toblerity / Fiona / tests / test_fio_dump.py View on Github external
def test_dump(path_coutwildrnp_shp):
    runner = CliRunner()
    result = runner.invoke(main_group, ['dump', path_coutwildrnp_shp])
    assert result.exit_code == 0
    assert '"FeatureCollection"' in result.output
github Toblerity / Fiona / tests / test_fio_ls.py View on Github external
def test_fio_ls_single_layer(data_dir):

    result = CliRunner().invoke(main_group, ['ls', data_dir])
    assert result.exit_code == 0
    assert len(result.output.splitlines()) == 1
    assert sorted(json.loads(result.output)) == ['coutwildrnp', 'gre', 'test_tin']
github Toblerity / Fiona / tests / test_fio_load.py View on Github external
def test_collection(tmpdir, feature_collection, runner):
    tmpfile = str(tmpdir.mkdir('tests').join('test_collection.shp'))
    result = runner.invoke(
        main_group, ['load', '-f', 'Shapefile', tmpfile], feature_collection)
    assert result.exit_code == 0
    assert len(fiona.open(tmpfile)) == 2
github Toblerity / Fiona / tests / test_fio_distrib.py View on Github external
def test_distrib(feature_collection_pp):
    runner = CliRunner()
    result = runner.invoke(main_group, ['distrib', ], feature_collection_pp)
    assert result.exit_code == 0
    assert result.output.count('"Feature"') == 2
github Toblerity / Fiona / tests / test_fio_filter.py View on Github external
def test_fail(runner):
    result = runner.invoke(main_group, ['filter',
        "f.properties.test > 5"
    ], "{'type': 'no_properties'}")
    assert result.exit_code == 1
github Toblerity / Fiona / tests / test_fio_collect.py View on Github external
def test_collect_noparse_rs(feature_seq_pp_rs):
    runner = CliRunner()
    result = runner.invoke(
        main_group, ['collect', '--no-parse'],
        feature_seq_pp_rs,
        catch_exceptions=False)
    assert result.exit_code == 0
    assert result.output.count('"Feature"') == 2
    assert len(json.loads(result.output)['features']) == 2
github Toblerity / Fiona / tests / test_fio_cat.py View on Github external
def test_bbox_yes(path_coutwildrnp_shp):
    runner = CliRunner()
    result = runner.invoke(
        main_group,
        ['cat', path_coutwildrnp_shp, '--bbox', '-109,37,-107,39'],
        catch_exceptions=False)
    assert result.exit_code == 0
    assert result.output.count('"Feature"') == 19
github Toblerity / Fiona / tests / test_fio_filter.py View on Github external
def test_seq(feature_seq, runner):

    result = runner.invoke(main_group, ['filter',
        "f.properties.AREA > 0.01"], feature_seq)
    assert result.exit_code == 0
    assert result.output.count('Feature') == 2

    result = runner.invoke(main_group, ['filter',
        "f.properties.AREA > 0.015"], feature_seq)
    assert result.exit_code == 0
    assert result.output.count('Feature') == 1

    result = runner.invoke(main_group, ['filter',
        "f.properties.AREA > 0.02"], feature_seq)
    assert result.exit_code == 0
    assert result.output.count('Feature') == 0
github Toblerity / Fiona / tests / test_fio_info.py View on Github external
def test_info_json():
    runner = CliRunner()
    result = runner.invoke(main_group, ['info', WILDSHP])
    assert result.exit_code == 0
    assert '"count": 67' in result.output
    assert '"crs": "EPSG:4326"' in result.output
    assert '"driver": "ESRI Shapefile"' in result.output
    assert '"name": "coutwildrnp"' in result.output