CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-fiona

Fiona reads and writes spatial data files

88

1.10x
Overview
Eval results
Files

schema.mddocs/

Schema and Field Types

Schema definition and validation system for specifying the structure of geospatial data, including field types, geometry types, and validation rules.

Capabilities

Schema Utility Functions

def prop_type(text):
    """
    Returns a schema property's proper Python type.
    
    Parameters:
    - text: str, type name with or without width
    
    Returns:
    type: Python class (int, str, float, etc.)
    """

def prop_width(val):
    """
    Returns the width of a str type property.
    
    Parameters:
    - val: str, type:width string from schema
    
    Returns:
    int or None: Width for string types, None for others
    """

Field Type Classes

Fiona supports various field types for representing different kinds of attribute data:

  • FionaIntegerType: 32-bit integers
  • FionaInt16Type: 16-bit integers
  • FionaBooleanType: Boolean values
  • FionaInteger64Type: 64-bit integers
  • FionaRealType: Floating point numbers
  • FionaStringType: String values
  • FionaBinaryType: Binary data
  • FionaStringListType: Lists of strings
  • FionaJSONType: JSON data
  • FionaDateType: Date values
  • FionaTimeType: Time values
  • FionaDateTimeType: DateTime values

Usage Examples

from fiona import prop_type, prop_width

# Get Python type from schema string
int_type = prop_type('int')        # <class 'int'>
str_type = prop_type('str:50')     # <class 'str'>
float_type = prop_type('float')    # <class 'float'>

# Get string field width
width = prop_width('str:25')       # 25
default_width = prop_width('str')  # 80
non_str_width = prop_width('int')  # None

# Schema definition example
schema = {
    'geometry': 'Point',
    'properties': {
        'name': 'str:50',      # String with max 50 characters
        'population': 'int',    # Integer
        'area': 'float',       # Float
        'active': 'bool',      # Boolean
        'founded': 'date',     # Date
        'metadata': 'json'     # JSON data
    }
}

Install with Tessl CLI

npx tessl i tessl/pypi-fiona

docs

cli.md

collection-management.md

crs.md

data-model.md

environment.md

file-io.md

index.md

schema.md

transforms.md

utilities.md

tile.json