Design and Evaluation of a Lightweight Reverse Geocoding API for Malaysian Location-Description Retrieval Using Spatial Indexing
Keywords:
Reverse geocoding, spatial indexing, Balltree, Web API, Edge ComputingAbstract
Reverse geocoding converts geographic coordinates into meaningful location descriptions. This study developed a lightweight local reverse geocoding API for Malaysian location-aware and embedded computing applications. The dataset contained more than 54,000 location records, including repeated coordinates associated with multiple descriptions. These records were reorganised into spatial groups so that descriptions sharing the same coordinate could be returned together. Four retrieval methods, namely KD-Tree, BallTree, Geohash, and H3, were implemented and evaluated against a brute-force haversine baseline using 1,000 coordinate queries. The evaluation measured query latency, agreement with the baseline, additional retrieval distance, and index preparation time. KD-Tree and BallTree achieved 100% agreement with the baseline and recorded zero distance difference. BallTree reduced mean retrieval latency from 0.302 ms for brute-force search to 0.135 ms. Although Geohash and H3 achieved slightly lower latency, both produced mismatched retrieval results with kilometre-scale maximum distance differences. BallTree was therefore selected as the preferred method because it provided efficient retrieval while preserving complete agreement with the geographic-distance reference. The proposed API provides a practical local approach for Malaysian coordinate-to-description retrieval in embedded monitoring and location-aware systems.










