The encoder package holds the reference implementation for the OpenLR encoder according to the OpenLR whitepaper. This encoder takes a location in a map and generates an OpenLR location reference for this specific location. The location reference is map independent and the OpenLR decoder uses this location reference for finding back the location in the decoder map. Encoder and decoder map might differ in version and might also rely on different map vendors.
The encoder package requires the OpenLR data and map package. The interfaces in the map package must also be implemented in order to access the application map database. The data package provides a PhysicalEncoder interface so that different physical formats can be used. The implementation of this interface needs to be registered as a service and the encoder will find all physical encoders automatically during runtime. The encoder is capable to encode a single location as well as a set of locations in a row (see Code example). The encoding process is configurable using encoder properties (see Configure the encoding process).
The implementation also offers logging functionality (log4j) which can be configured using the logging.properties file provided in the package or you need to put a file name log4j.properties in your classpath.
Further details of the encoding steps can be found in the OpenLR whitepaper and also in the code documentation.