How to use the fiona.prop_type 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_props.py View on Github external
def test_types():
    assert prop_type('str:254') == text_type
    assert prop_type('str') == text_type
    assert isinstance(0, prop_type('int'))
    assert isinstance(0.0, prop_type('float'))
    assert prop_type('date') == FionaDateType
github bukun / book_python_gis / part010 / ch03_ogr / sec5_fiona / test_3_schema_x_x.py View on Github external
pprint(c.schema)
###############################################################################
rec = next(c)
set(rec.keys()) - set(c.schema.keys())
set(rec['properties'].keys()) == set(
    c.schema['properties'].keys())
###############################################################################
type(rec['properties']['source'])
c.schema['properties']['source']
###############################################################################
from fiona import prop_width
prop_width('str:25')
prop_width('str')
###############################################################################
from fiona import prop_type
prop_type('int')
prop_type('float')
prop_type('str:25')
###############################################################################
c = fiona.open('/gdata/GSHHS_c.shp')
rec = c.next()
pprint(rec)
###############################################################################
c.close()
rec['id']
###############################################################################
c = fiona.open('/gdata/GSHHS_c.shp')
rec = next(c)
rec['id']
###############################################################################
pprint(rec['properties'])
###############################################################################
github Toblerity / Fiona / tests / test_props.py View on Github external
def test_types():
    assert prop_type('str:254') == text_type
    assert prop_type('str') == text_type
    assert isinstance(0, prop_type('int'))
    assert isinstance(0.0, prop_type('float'))
    assert prop_type('date') == FionaDateType
github Toblerity / Fiona / tests / test_props.py View on Github external
def test_types():
    assert prop_type('str:254') == text_type
    assert prop_type('str') == text_type
    assert isinstance(0, prop_type('int'))
    assert isinstance(0.0, prop_type('float'))
    assert prop_type('date') == FionaDateType
github Toblerity / Fiona / tests / test_props.py View on Github external
def test_types():
    assert prop_type('str:254') == text_type
    assert prop_type('str') == text_type
    assert isinstance(0, prop_type('int'))
    assert isinstance(0.0, prop_type('float'))
    assert prop_type('date') == FionaDateType
github bukun / book_python_gis / part010 / ch03_ogr / sec5_fiona / test_3_schema_x_x.py View on Github external
rec = next(c)
set(rec.keys()) - set(c.schema.keys())
set(rec['properties'].keys()) == set(
    c.schema['properties'].keys())
###############################################################################
type(rec['properties']['source'])
c.schema['properties']['source']
###############################################################################
from fiona import prop_width
prop_width('str:25')
prop_width('str')
###############################################################################
from fiona import prop_type
prop_type('int')
prop_type('float')
prop_type('str:25')
###############################################################################
c = fiona.open('/gdata/GSHHS_c.shp')
rec = c.next()
pprint(rec)
###############################################################################
c.close()
rec['id']
###############################################################################
c = fiona.open('/gdata/GSHHS_c.shp')
rec = next(c)
rec['id']
###############################################################################
pprint(rec['properties'])
###############################################################################
pprint(rec['geometry'])
github Toblerity / Fiona / tests / test_props.py View on Github external
def test_types():
    assert prop_type('str:254') == text_type
    assert prop_type('str') == text_type
    assert isinstance(0, prop_type('int'))
    assert isinstance(0.0, prop_type('float'))
    assert prop_type('date') == FionaDateType
github NCPP / ocgis / src / ocgis / interface / base / dimension / spatial.py View on Github external
def get_numpy_dtype_from_schema(schema):
    dtype = []
    for k, v in schema.iteritems():
        if v.startswith('str'):
            if ':' in v:
                length = v.split(':')[1]
            else:
                length = 80
            nd = 'S{0}'.format(length)
        else:
            nd = fiona.prop_type(v)
        dtype.append((str(k), nd))
    return dtype