Free-form metadata for spatial clouds.
Fields
:entries—%{optional(String.t()) => term()}arbitrary format or application values; defaults to%{}. String keys are the public API convention.:comments—[String.t()]ordered human-readable comments; defaults to[]. No encoding beyond Elixir UTF-8 string conventions is imposed.:source—String.t() | nilsource file, URI, sensor, or producer identifier; defaults tonil.:created_at—DateTime.t() | nilcreation instant; defaults tonil. Use a timezone-awareDateTime, conventionally UTC.
Example
iex> created_at = ~U[2026-07-16 12:00:00Z]
iex> ExCodecs.Spatial.Metadata.new(
...> entries: %{"coordinate_system" => "ENU"},
...> comments: ["Captured after calibration"],
...> source: "sensor://roof-lidar",
...> created_at: created_at
...> )
%ExCodecs.Spatial.Metadata{
entries: %{"coordinate_system" => "ENU"},
comments: ["Captured after calibration"],
source: "sensor://roof-lidar",
created_at: ~U[2026-07-16 12:00:00Z]
}
Summary
Types
Spatial metadata. See the module documentation for every field, its default, units or conventions, and a construction example.
Functions
Appends a comment string.
Fetches an entry by string key.
Builds metadata from options.
Puts a string key into entries.
Types
@type t() :: %ExCodecs.Spatial.Metadata{ comments: [String.t()], created_at: DateTime.t() | nil, entries: %{optional(String.t()) => term()}, source: String.t() | nil }
Spatial metadata. See the module documentation for every field, its default, units or conventions, and a construction example.
Functions
Appends a comment string.
Arguments
meta—%Metadata{}comment—String.t()appended after existing comments.
Returns
Updated %Metadata{}
Raises
FunctionClauseErrorunlessmetais%Metadata{}andcommentis a binary.ArgumentErrorif a manually constructed metadata value has an improper:commentslist.
Examples
iex> m = ExCodecs.Spatial.Metadata.add_comment(ExCodecs.Spatial.Metadata.new(), "x")
iex> m.comments
["x"]
Fetches an entry by string key.
Arguments
meta—%Metadata{}key—String.t()to look up.default—term()returned when the key is absent; defaults tonil.
Returns
Stored value or default
Raises
FunctionClauseErrorunlessmetais%Metadata{}andkeyis a binary.BadMapErrorif a manually constructed metadata value has a non-map:entriesfield.
Examples
iex> ExCodecs.Spatial.Metadata.get(ExCodecs.Spatial.Metadata.new(), "missing", :nope)
:nope
Builds metadata from options.
Arguments
opts— a keyword list with::entries— an enumerable accepted byMap.new/1, conventionally a map with string keys; defaults to%{}.:comments—[String.t()]; defaults to[].:source—String.t() | nil; defaults tonil.:created_at—DateTime.t() | nil; defaults tonil.
Returns
%Metadata{}
Raises
FunctionClauseErrorifoptsis not a keyword list.Protocol.UndefinedErrorif:entriesis not enumerable.ArgumentErrorif an enumerable entry cannot be converted to a map pair.
Examples
iex> m = ExCodecs.Spatial.Metadata.new(comments: ["hi"], entries: %{"k" => 1})
iex> m.comments
["hi"]
Puts a string key into entries.
Arguments
meta—%Metadata{}key—String.t()key.value—term()to store, replacing an existing value.
Returns
Updated %Metadata{}
Raises
FunctionClauseErrorunlessmetais%Metadata{}andkeyis a binary.BadMapErrorif a manually constructed metadata value has a non-map:entriesfield.
Examples
iex> m = ExCodecs.Spatial.Metadata.put(ExCodecs.Spatial.Metadata.new(), "a", 1)
iex> ExCodecs.Spatial.Metadata.get(m, "a")
1