Latitude and longitude values and information related to the location (such as place names) are registered in nsf as one document.
I want to get the document that is closest to the latitude / longitude obtained by NotesGPSCoodinates class.
The current code prepares a view that displays latitude and longitude in columns, repeats calculating the distance from the first view entry, and holds the document ID with the shortest distance calculated up to the last entry.
Since this code performs distance calculations on the caller side, I know that the more view entries, the more data communication and the less efficient.
In SQL, functions such as SQRT can be used to write expressions. For example, the following code:
SELECT SQRT (POWER ((35.690224 – lat) / 0.0111, 2) + POWER ((139.700089 – lng) / 0.0091, 2)) AS distance FROM geodata ORDER BY distance
If DQL has expressions and functions that can be used in a query like this, it will be possible to efficiently obtain information that is closest to the current location.