What3Words Event Processor for Search Widgets
This Event Processor converts a latitude/longitude field to a what3words phrase then converts it back to a latitude/longitude for searching.
Liberty Create only supports the equals/not equals and empty/not empty comparators for Latitude & Longitude fields. It does not support greater/less or range type searches. So why is this an issue? Well the map presenter will produce a latitude or longitude to 9 decimal places (which is approximately 1mm accuracy at the equator). The data entry boxes allow you to enter latitude and longitude to 6 decimal places (approximately 1m accuracy) and what3words provides a 3m square (actually the latitude/longitude of the centre of the square). Therefore, it is inevitable that any latitude/longitude entered other than via what3words will not match on a search.
So how do we get around this? Leaving aside the option to only enter Latitude/Longitude via the presenter, the only realistic way is to convert any latitude/longitude value entered into a “normalised” form – essentially moving it to the centre of the what3words square. The down side is you lose accuracy by a meter or so, the up side is that you can then search and find what you expect. The simplest way to do this is an event processor, triggered on either an event or on a change of value that first convert the latitude/longitude to a what3words phrase then converts back to a latitude/longitude – at the centre of the square.
This Event Processor works in conjunction with the What3Words Presenter .