Location Filters
Overview
The Location Filters feature in Replyke allows you or your users to filter entities within a specified radius of a given geographic coordinate. This is particularly useful for applications that involve location-based content, such as local events, businesses, or nearby user posts. With Location Filters, users can narrow down their entity list (content feed) to display only entities relevant to a specific location.How It Works
ThelocationFilters prop is used to define the geographic filter parameters. The filter expects an object of type LocationFilters, which contains the latitude, longitude, and radius (in meters) to define the area of interest.
fetchEntities function to apply location filtering. To dynamically adjust the location filters, call fetchEntities with the desired location configuration.
- Setting the filters to
nullremoves the location-based filtering. - Providing valid
latitude,longitude, andradiusvalues applies the filter.
Example Usage
To change the location filter dynamically, use thefetchEntities function:
Notes
- Precision: Ensure the latitude and longitude values are precise enough for the desired filtering. Slight inaccuracies in coordinates may result in unexpected results.
- Radius Limitations: The radius value determines the size of the filtering area in meters. Be mindful of performance implications when using very large radii.
- No Location Filter: If
locationFiltersis set tonullinfetchEntities, the system will ignore location as a filtering criterion when fetching entities.
Conclusion
Location Filters provide a powerful way to enhance entity lists’ relevance by focusing on geographic proximity. Whether used statically during initialization or dynamically via thefetchEntities function, this feature enables users to tailor their content feeds for a highly localized experience. Combine it with other filters like Keywords or Title Filters for even more precise content curation.
