DictionaryStore¶
- class DictionaryStore(*args, **kwargs)[source]¶
Pure python dictionary backed annotation store.
Initialize
DictionaryStore.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.
Return 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.
- Parameters:
connection (Path | str | IO)
- 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.
self (DictionaryStore)
- Returns:
The unique key of the newly inserted annotation.
- Return type:
- close()[source]¶
Closes
DictionaryStorefrom file pointer or path.- Parameters:
self (DictionaryStore)
- Return type:
None
- commit()[source]¶
Commit any in-memory changes to disk.
- Parameters:
self (DictionaryStore)
- 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.
self (DictionaryStore)
- Return type:
None
- dumps()[source]¶
Serialise and return a copy of store as a string or bytes.
- Returns:
The serialised store.
- Return type:
- Parameters:
self (DictionaryStore)
- items()[source]¶
Return iterable (generator) over key and annotations.
- Parameters:
self (DictionaryStore)
- Return type:
- 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__.
- Parameters:
key (str) – The key of the annotation to update.
geometry (Geometry) – The new geometry. If None, the geometry is not updated.
properties (dict) – A dictionary of properties to patch and their new values. If None, the existing properties are not altered.
self (DictionaryStore)
- Return type:
None
- remove(key)[source]¶
Remove annotation from the store with its unique key.
- Parameters:
key (str) – The key of the annotation to be removed.
self (DictionaryStore)
- Return type:
None