DictionaryStore#
- class DictionaryStore(*args, **kwargs)[source]#
Pure python dictionary backed annotation store.
Return an instance of a subclass of AnnotationStore.
Methods
Insert a new annotation, returning the key.
Closes
DictionaryStorefrom file pointer or path.Commit any in-memory changes to disk.
Serialise a copy of the whole store to a file-like object.
Serialise and return a copy of store as a string or bytes.
Returns iterable (generator) over key and annotations.
Opens
DictionaryStorefrom file pointer or path.Patch an annotation at given key.
Remove annotation from the store with its unique key.
- append(annotation, key=None)[source]#
Insert a new annotation, returning the key.
- Parameters:
annotation (Annotation) – The shapely annotation to insert.
key (str) – Optional. The unique key used to identify the annotation in the store. If not given a new UUID4 will be generated and returned instead.
- Returns:
The unique key of the newly inserted annotation.
- Return type:
- close()[source]#
Closes
DictionaryStorefrom file pointer or path.- Return type:
None
- dump(fp)[source]#
Serialise a copy of the whole store to a file-like object.
- Parameters:
fp (Path or str or IO) – A file path or file handle object for output to disk.
- Return type:
None
- items()[source]#
Returns iterable (generator) over key and annotations.
- Return type:
Generator[Tuple[str, Annotation], None, None]
- classmethod open(fp)[source]#
Opens
DictionaryStorefrom file pointer or path.- Parameters:
- Return type:
- patch(key, geometry=None, properties=None)[source]#
Patch an annotation at given key.
Partial update of an annotation. Providing only a geometry will update the geometry and leave properties unchanged. Providing a properties dictionary applies a patch operation to the properties. Only updating the properties which are given and leaving the rest unchanged. To completely replace an annotation use __setitem__.