or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

cli.mdcollection-management.mdcrs.mddata-model.mdenvironment.mdfile-io.mdindex.mdschema.mdtransforms.mdutilities.md

schema.mddocs/

0

# Schema and Field Types

1

2

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

3

4

## Capabilities

5

6

### Schema Utility Functions

7

8

```python { .api }

9

def prop_type(text):

10

"""

11

Returns a schema property's proper Python type.

12

13

Parameters:

14

- text: str, type name with or without width

15

16

Returns:

17

type: Python class (int, str, float, etc.)

18

"""

19

20

def prop_width(val):

21

"""

22

Returns the width of a str type property.

23

24

Parameters:

25

- val: str, type:width string from schema

26

27

Returns:

28

int or None: Width for string types, None for others

29

"""

30

```

31

32

### Field Type Classes

33

34

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

35

36

- **FionaIntegerType**: 32-bit integers

37

- **FionaInt16Type**: 16-bit integers

38

- **FionaBooleanType**: Boolean values

39

- **FionaInteger64Type**: 64-bit integers

40

- **FionaRealType**: Floating point numbers

41

- **FionaStringType**: String values

42

- **FionaBinaryType**: Binary data

43

- **FionaStringListType**: Lists of strings

44

- **FionaJSONType**: JSON data

45

- **FionaDateType**: Date values

46

- **FionaTimeType**: Time values

47

- **FionaDateTimeType**: DateTime values

48

49

#### Usage Examples

50

51

```python

52

from fiona import prop_type, prop_width

53

54

# Get Python type from schema string

55

int_type = prop_type('int') # <class 'int'>

56

str_type = prop_type('str:50') # <class 'str'>

57

float_type = prop_type('float') # <class 'float'>

58

59

# Get string field width

60

width = prop_width('str:25') # 25

61

default_width = prop_width('str') # 80

62

non_str_width = prop_width('int') # None

63

64

# Schema definition example

65

schema = {

66

'geometry': 'Point',

67

'properties': {

68

'name': 'str:50', # String with max 50 characters

69

'population': 'int', # Integer

70

'area': 'float', # Float

71

'active': 'bool', # Boolean

72

'founded': 'date', # Date

73

'metadata': 'json' # JSON data

74

}

75

}

76

```