only sync pois nearby current location in google maps
I want my application to synchronize only the poi locations in the neigbourhood of mij current location. I think this can be realised bij a xpath constraint but do not know how to do this exactly. De POI logitude en latitude are in the entity "pois". In another antity "location" i have te longitude en latitude of the current location. Please help me wit the xpath constraint.
I don't think there's a way to write this in XPath. You would need to run a distance calculation between your location and every point in your database, which could be very slow depending on the number of rows you're searching.
Here's another thread I found on the matter. Based on this, here's how I would approach the issue:
Find the upper and lower bounds for the latitude and longitude of your current location and radius. This will effectively give you a rectangular area around your current location
Write your XPath to get all POIs inside that rectangle
For each POI returned, run a distance calculation between that point and your current location. If it's within the radius, keep it. If not, remove it from the POI list.