Skip to content

Module tifeatures.layer

tifeatures.layers.

Variables

geojson_schema

Classes

CollectionLayer

class CollectionLayer(
    __pydantic_self__,
    **data: Any
)

Layer's Abstract BaseClass.

Attributes

Name Type Description Default
id str Layer's name. None
bounds list Layer's bounds (left, bottom, right, top). None
crs str Coordinate reference system of the Collection. None
title str Layer's title None
description str Layer's description None

Ancestors (in MRO)

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Descendants

  • tifeatures.layer.Table

Class variables

Config

Static methods

construct

def construct(
    _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
    **values: Any
) -> 'Model'

Creates a new model setting dict and fields_set from trusted or pre-validated data.

Default values are respected, but no other validation is performed. Behaves as if Config.extra = 'allow' was set since it adds all passed values

from_orm

def from_orm(
    obj: Any
) -> 'Model'

parse_file

def parse_file(
    path: Union[str, pathlib.Path],
    *,
    content_type: 'unicode' = None,
    encoding: 'unicode' = 'utf8',
    proto: pydantic.parse.Protocol = None,
    allow_pickle: bool = False
) -> 'Model'

parse_obj

def parse_obj(
    obj: Any
) -> 'Model'

parse_raw

def parse_raw(
    b: Union[str, bytes],
    *,
    content_type: 'unicode' = None,
    encoding: 'unicode' = 'utf8',
    proto: pydantic.parse.Protocol = None,
    allow_pickle: bool = False
) -> 'Model'

schema

def schema(
    by_alias: bool = True,
    ref_template: 'unicode' = '#/definitions/{model}'
) -> 'DictStrAny'

schema_json

def schema_json(
    *,
    by_alias: bool = True,
    ref_template: 'unicode' = '#/definitions/{model}',
    **dumps_kwargs: Any
) -> 'unicode'

update_forward_refs

def update_forward_refs(
    **localns: Any
) -> None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

validate

def validate(
    value: Any
) -> 'Model'

Instance variables

queryables

Return the queryables.

Methods

copy

def copy(
    self: 'Model',
    *,
    include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
    exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
    update: Union[ForwardRef('DictStrAny'), NoneType] = None,
    deep: bool = False
) -> 'Model'

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters:

Name Type Description Default
include None fields to include in new model None
exclude None fields to exclude from new model, as with values this takes precedence over include None
update None values to change/add in the new model. Note: the data is not validated before creating
the new model: you should trust this data
None
deep None set to True to make a deep copy of the model None

Returns:

Type Description
None new model instance

dict

def dict(
    self,
    *,
    include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
    exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
    by_alias: bool = False,
    skip_defaults: Union[bool, NoneType] = None,
    exclude_unset: bool = False,
    exclude_defaults: bool = False,
    exclude_none: bool = False
) -> 'DictStrAny'

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

features

def features(
    self,
    pool: buildpg.asyncpg.BuildPgPool,
    *,
    ids_filter: Union[List[str], NoneType] = None,
    bbox_filter: Union[List[float], NoneType] = None,
    datetime_filter: Union[List[str], NoneType] = None,
    properties_filter: Union[List[Tuple[str, str]], NoneType] = None,
    cql_filter: Union[ForwardRef('Node'), pygeofilter.values.Geometry, pygeofilter.values.Envelope, datetime.date, datetime.datetime, datetime.timedelta, pygeofilter.values.Interval, bool, float, int, str, list, NoneType] = None,
    sortby: Union[str, NoneType] = None,
    properties: Union[List[str], NoneType] = None,
    geom: Union[str, NoneType] = None,
    dt: Union[str, NoneType] = None,
    limit: Union[int, NoneType] = None,
    offset: Union[int, NoneType] = None,
    bbox_only: Union[bool, NoneType] = None,
    simplify: Union[float, NoneType] = None,
    geom_as_wkt: bool = False
) -> Tuple[tifeatures.layer.FeatureCollection, int]

Return a FeatureCollection and the number of matched items.

json

def json(
    self,
    *,
    include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
    exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
    by_alias: bool = False,
    skip_defaults: Union[bool, NoneType] = None,
    exclude_unset: bool = False,
    exclude_defaults: bool = False,
    exclude_none: bool = False,
    encoder: Union[Callable[[Any], Any], NoneType] = None,
    models_as_dict: bool = True,
    **dumps_kwargs: Any
) -> 'unicode'

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().

Feature

class Feature(
    /,
    *args,
    **kwargs
)

Simple Feature model.

Ancestors (in MRO)

  • builtins.dict

Methods

clear

def clear(
    ...
)

D.clear() -> None. Remove all items from D.

copy

def copy(
    ...
)

D.copy() -> a shallow copy of D

fromkeys

def fromkeys(
    iterable,
    value=None,
    /
)

Create a new dictionary with keys from iterable and values set to value.

get

def get(
    self,
    key,
    default=None,
    /
)

Return the value for key if key is in the dictionary, else default.

items

def items(
    ...
)

D.items() -> a set-like object providing a view on D's items

keys

def keys(
    ...
)

D.keys() -> a set-like object providing a view on D's keys

pop

def pop(
    ...
)

D.pop(k[,d]) -> v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised

popitem

def popitem(
    self,
    /
)

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault

def setdefault(
    self,
    key,
    default=None,
    /
)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update

def update(
    ...
)

D.update([E, ]**F) -> None. Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values

def values(
    ...
)

D.values() -> an object providing a view on D's values

FeatureCollection

class FeatureCollection(
    /,
    *args,
    **kwargs
)

Simple FeatureCollection model.

Ancestors (in MRO)

  • builtins.dict

Methods

clear

def clear(
    ...
)

D.clear() -> None. Remove all items from D.

copy

def copy(
    ...
)

D.copy() -> a shallow copy of D

fromkeys

def fromkeys(
    iterable,
    value=None,
    /
)

Create a new dictionary with keys from iterable and values set to value.

get

def get(
    self,
    key,
    default=None,
    /
)

Return the value for key if key is in the dictionary, else default.

items

def items(
    ...
)

D.items() -> a set-like object providing a view on D's items

keys

def keys(
    ...
)

D.keys() -> a set-like object providing a view on D's keys

pop

def pop(
    ...
)

D.pop(k[,d]) -> v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised

popitem

def popitem(
    self,
    /
)

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault

def setdefault(
    self,
    key,
    default=None,
    /
)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update

def update(
    ...
)

D.update([E, ]**F) -> None. Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values

def values(
    ...
)

D.values() -> an object providing a view on D's values

RawComponent

class RawComponent(
    val
)

Enable building statements with more complicated logic.

Ancestors (in MRO)

  • buildpg.components.VarLiteral
  • buildpg.components.RawDangerous
  • builtins.str

Static methods

maketrans

def maketrans(
    ...
)

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

Instance variables

val

Methods

capitalize

def capitalize(
    self,
    /
)

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold

def casefold(
    self,
    /
)

Return a version of the string suitable for caseless comparisons.

center

def center(
    self,
    width,
    fillchar=' ',
    /
)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count

def count(
    ...
)

S.count(sub[, start[, end]]) -> int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode

def encode(
    self,
    /,
    encoding='utf-8',
    errors='strict'
)

Encode the string using the codec registered for encoding.

encoding The encoding in which to encode the string. errors The error handling scheme to use for encoding errors. The default is 'strict' meaning that encoding errors raise a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and 'xmlcharrefreplace' as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith

def endswith(
    ...
)

S.endswith(suffix[, start[, end]]) -> bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs

def expandtabs(
    self,
    /,
    tabsize=8
)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find

def find(
    ...
)

S.find(sub[, start[, end]]) -> int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format

def format(
    ...
)

S.format(args, *kwargs) -> str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces ('{' and '}').

format_map

def format_map(
    ...
)

S.format_map(mapping) -> str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces ('{' and '}').

index

def index(
    ...
)

S.index(sub[, start[, end]]) -> int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum

def isalnum(
    self,
    /
)

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha

def isalpha(
    self,
    /
)

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii

def isascii(
    self,
    /
)

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal

def isdecimal(
    self,
    /
)

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit

def isdigit(
    self,
    /
)

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier

def isidentifier(
    self,
    /
)

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as "def" or "class".

islower

def islower(
    self,
    /
)

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric

def isnumeric(
    self,
    /
)

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable

def isprintable(
    self,
    /
)

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace

def isspace(
    self,
    /
)

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle

def istitle(
    self,
    /
)

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper

def isupper(
    self,
    /
)

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join

def join(
    self,
    iterable,
    /
)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'

ljust

def ljust(
    self,
    width,
    fillchar=' ',
    /
)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower

def lower(
    self,
    /
)

Return a copy of the string converted to lowercase.

lstrip

def lstrip(
    self,
    chars=None,
    /
)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition

def partition(
    self,
    sep,
    /
)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

render

def render(
    self
)

Render

replace

def replace(
    self,
    old,
    new,
    count=-1,
    /
)

Return a copy with all occurrences of substring old replaced by new.

count Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind

def rfind(
    ...
)

S.rfind(sub[, start[, end]]) -> int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex

def rindex(
    ...
)

S.rindex(sub[, start[, end]]) -> int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust

def rjust(
    self,
    width,
    fillchar=' ',
    /
)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition

def rpartition(
    self,
    sep,
    /
)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit

def rsplit(
    self,
    /,
    sep=None,
    maxsplit=-1
)

Return a list of the words in the string, using sep as the delimiter string.

sep The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result. maxsplit Maximum number of splits to do. -1 (the default value) means no limit.

Splits are done starting at the end of the string and working to the front.

rstrip

def rstrip(
    self,
    chars=None,
    /
)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split

def split(
    self,
    /,
    sep=None,
    maxsplit=-1
)

Return a list of the words in the string, using sep as the delimiter string.

sep The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result. maxsplit Maximum number of splits to do. -1 (the default value) means no limit.

splitlines

def splitlines(
    self,
    /,
    keepends=False
)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith

def startswith(
    ...
)

S.startswith(prefix[, start[, end]]) -> bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip

def strip(
    self,
    chars=None,
    /
)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase

def swapcase(
    self,
    /
)

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title

def title(
    self,
    /
)

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate

def translate(
    self,
    table,
    /
)

Replace each character in the string using the given translation table.

table Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via getitem, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper

def upper(
    self,
    /
)

Return a copy of the string converted to uppercase.

zfill

def zfill(
    self,
    width,
    /
)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

Table

class Table(
    __pydantic_self__,
    **data: Any
)

Table Reader.

Attributes

Name Type Description Default
id str Layer's name. None
bounds list Layer's bounds (left, bottom, right, top). None
crs str Coordinate reference system of the Table. None
type str Layer's type. None
schema str Table's database schema (e.g public). None
geometry_type str Table's geometry type (e.g polygon). None
srid int Table's SRID None
geometry_column str Name of the geomtry column in the table. None
properties Dict Properties available in the table. None

Ancestors (in MRO)

  • tifeatures.layer.CollectionLayer
  • tifeatures.dbmodel.Table
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

Config

Static methods

bounds_default

def bounds_default(
    values
)

Get default bounds from the first geometry columns.

construct

def construct(
    _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
    **values: Any
) -> 'Model'

Creates a new model setting dict and fields_set from trusted or pre-validated data.

Default values are respected, but no other validation is performed. Behaves as if Config.extra = 'allow' was set since it adds all passed values

from_orm

def from_orm(
    obj: Any
) -> 'Model'

parse_file

def parse_file(
    path: Union[str, pathlib.Path],
    *,
    content_type: 'unicode' = None,
    encoding: 'unicode' = 'utf8',
    proto: pydantic.parse.Protocol = None,
    allow_pickle: bool = False
) -> 'Model'

parse_obj

def parse_obj(
    obj: Any
) -> 'Model'

parse_raw

def parse_raw(
    b: Union[str, bytes],
    *,
    content_type: 'unicode' = None,
    encoding: 'unicode' = 'utf8',
    proto: pydantic.parse.Protocol = None,
    allow_pickle: bool = False
) -> 'Model'

schema

def schema(
    by_alias: bool = True,
    ref_template: 'unicode' = '#/definitions/{model}'
) -> 'DictStrAny'

schema_json

def schema_json(
    *,
    by_alias: bool = True,
    ref_template: 'unicode' = '#/definitions/{model}',
    **dumps_kwargs: Any
) -> 'unicode'

update_forward_refs

def update_forward_refs(
    **localns: Any
) -> None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

validate

def validate(
    value: Any
) -> 'Model'

Instance variables

id_column_info

Return Column for a unique identifier.

queryables

Return the queryables.

Methods

columns

def columns(
    self,
    properties: Union[List[str], NoneType] = None
) -> List[str]

Return table columns optionally filtered to only include columns from properties.

copy

def copy(
    self: 'Model',
    *,
    include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
    exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
    update: Union[ForwardRef('DictStrAny'), NoneType] = None,
    deep: bool = False
) -> 'Model'

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters:

Name Type Description Default
include None fields to include in new model None
exclude None fields to exclude from new model, as with values this takes precedence over include None
update None values to change/add in the new model. Note: the data is not validated before creating
the new model: you should trust this data
None
deep None set to True to make a deep copy of the model None

Returns:

Type Description
None new model instance

dict

def dict(
    self,
    *,
    include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
    exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
    by_alias: bool = False,
    skip_defaults: Union[bool, NoneType] = None,
    exclude_unset: bool = False,
    exclude_defaults: bool = False,
    exclude_none: bool = False
) -> 'DictStrAny'

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

features

def features(
    self,
    pool: buildpg.asyncpg.BuildPgPool,
    *,
    ids_filter: Union[List[str], NoneType] = None,
    bbox_filter: Union[List[float], NoneType] = None,
    datetime_filter: Union[List[str], NoneType] = None,
    properties_filter: Union[List[Tuple[str, str]], NoneType] = None,
    cql_filter: Union[ForwardRef('Node'), pygeofilter.values.Geometry, pygeofilter.values.Envelope, datetime.date, datetime.datetime, datetime.timedelta, pygeofilter.values.Interval, bool, float, int, str, list, NoneType] = None,
    sortby: Union[str, NoneType] = None,
    properties: Union[List[str], NoneType] = None,
    geom: Union[str, NoneType] = None,
    dt: Union[str, NoneType] = None,
    limit: Union[int, NoneType] = None,
    offset: Union[int, NoneType] = None,
    bbox_only: Union[bool, NoneType] = None,
    simplify: Union[float, NoneType] = None,
    geom_as_wkt: bool = False
) -> Tuple[tifeatures.layer.FeatureCollection, int]

Build and run Pg query.

get_column

def get_column(
    self,
    property_name: str
) -> Union[tifeatures.dbmodel.Column, NoneType]

Return column info.

get_datetime_column

def get_datetime_column(
    self,
    name: Union[str, NoneType] = None
) -> Union[tifeatures.dbmodel.Column, NoneType]

Return the Column for either the passed in tstz column or the first tstz column.

get_geometry_column

def get_geometry_column(
    self,
    name: Union[str, NoneType] = None
) -> Union[tifeatures.dbmodel.GeometryColumn, NoneType]

Return the name of the first geometry column.

json

def json(
    self,
    *,
    include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
    exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
    by_alias: bool = False,
    skip_defaults: Union[bool, NoneType] = None,
    exclude_unset: bool = False,
    exclude_defaults: bool = False,
    exclude_none: bool = False,
    encoder: Union[Callable[[Any], Any], NoneType] = None,
    models_as_dict: bool = True,
    **dumps_kwargs: Any
) -> 'unicode'

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().