We rolled out some improvements to the location-based filtering that should improve both reliability of results and performance. When you zoom or move on the map, Sportsity recalculates which places fit in the current map view. We tried a few approaches, most of which, frankly, sucked, and finally settled on a decent bounding-box algorithm. We're also using a cool library called ClusterMarker that helps to manage the display of markers when they overlap.
The next feature we're looking to release is advanced filtering so that you can view only those places that are relevant to your interests. This will mark the beginnings of personalization, allowing your profile to drive a better user experience. There are some challenges with filtering due to the limitations of Google App Engine, so we're spending some time trying to make sure we can offer a good feature-set without sacrificing performance.
Subscribe to:
Post Comments (Atom)
2 comments:
What bounding box algorithm did you end up on? Geohash or something else?
I'm curious as I'm about to end up in the same boat on a GAE project I'm working on.
Hi Mike. I didn't find geohash too helpful for this, although you could store geohashes to represent min and max coordinates for your bounding boxes. This might cut down on storage but doesn't really change the core algorithm.
After searching in vain for an "easy" way to handle the location filtering, I ended up using bounding boxes of length and width one degree. When I store a site's location (lat/lng), I also store the bounding box coordinates (based on the nearest whole number lat and lng). Then when I need to query for, say, all sites within a certain area, I first determine how many total bounding boxes I will need to compare, then I run as many GAE queries as necessary and concatenate the results.
I may not be explaining this well...for example, if I want all locations in a 3 degree by 3 degree square, I perform 3 queries with a filter that looks like this:
q.filter("bbminlng >= ", minlng)
q.filter("bbminlng <= ", maxlng)
q.filter("bbminlat = ", minlat) q.filter("bbmaxlat = ", maxlat)
while varying the 2 lat values. This at least takes advantage of the fact that you can use inequalities on one property to "search" 3 bounding boxes at a time.
The problem is that if I want to look at wider areas, I have to perform more queries to cover the additional bounding boxes, and it can get inefficient. However, that's not a huge issue if you constrain the size of the search area.
If this doesn't make sense, let me know and I can send you some code (warning, it's a bit ugly). Drawing up a grid of 3x3 bounding boxes always helps clarify it visually for me.
Post a Comment