Posted: Jul. 20, 2008
As mentioned before, I’m beginning to incorporate geospatial queries into chinabites. Geospatial query results help users answer questions like “What are the 5 closest restaurants to me?” or “What are some other restaurants near this one?”
Currently the only geospatial query available in production hides under the map tab on all of the restaurant detail pages. When clicked it shows the 5 nearest locations closest to the current restaurant. This presents a problem for map display because you don’t know how far apart those 5 closest restaurants will be, so there is no way to correctly set the zoom level on the map to guarantee that all of the closest restaurants will be on the map.
Fortunately Google already thought of this problem and lets you set the bounds of the map dynamically if you feed in all of the points you want to display on the map. So I wrote a quick fix for the nearby restaurants view using this handy tool and voila, optimally zoomed maps for all future geospatial queries.
On another note, Google has published an english vector map of Beijing, no doubt just in time for the Olympics. Sadly, it seems to have a slight latitude offset from Google’s satelite map, so all of the geo data from chinabites displays correctly on the satellite map, but incorrectly on the vector map. Google seems to be aware of this offset problem, because currently there is no “hybrid” view of vector / satellite imagery for Beijing.
Because that English vector map is so cool, I might have to write a little code that applies the latitude shift to all chinabites data.