You can specify a custom Codec
instance for the majority of the Store
implementations in the LuciadRIA API.
The Codec
converts a server-specific or file-specific data format to the LuciadRIA Feature
interface, and the other way around. See the Introduction to feature (vector) models tutorial for more information.
The structure of a Store
that uses a Codec
for the interpretation of the data ensures a clean separation between the actual client-server communication and the server-specific
format logic.
Supporting more formats becomes a matter of writing new codecs without the need to re-implement the communication protocol
with the server.
For example, if you want to support a WFS server that serves data in several formats, create a codec for each of those formats.
Then, set that custom codec on a WFS store.
You don’t have to implement the WFS communication protocol again, because you can re-use the existing WFS store WFSFeatureStore
.
The samples contain a custom Codec
implementation: see the samples/createedit/CustomJsonCodec.js
file.