From: Bill Eisenhauer Date: 2008-01-04T00:04:48+09:00 Subject: Re: spatial search & search radius circumference with Geokit Xin Zheng wrote: > Bill Eisenhauer wrote: >> What would the API be? >> > > Hi Bill, > > Thanks for the quick reply. It's fantastic you guys are so responsive. > > > The API could be: > > data_with_location, radius_points = MappableModel.find(:all, :origin => > [lat, lng], :within => distance, :return_radius_points => true) > > I think it will be good having an option in the find method. I am not > sure how the radius points should be returned, as returning it to two > vars is unconventional. > > radius_points = [[lat,lng],[lat,lng],...] > > FYI. I am using KML with Google Maps. KML wants the coordinates like > this: > > -112.3372510731295,36.14888505105317,1784 > -112.3356128688403,36.14781540589019,1784 > -112.3368169371048,36.14658677734382,1784 > -112.3384408457543,36.14762778914076,1784 > -112.3372510731295,36.14888505105317,1784 > > > Perhaps radius_points can be an object with helper method to_kml: > radius_points.to_kml > > What do you think? I'm not sure I would put this under "find". We will probably add it as method to our Mappable module which will get mixed into a model. However, it'll probably respond to some different type of method name to isolate it away from database semantics. Let me get with Andre and see what can come up with. -- Posted via http://www.ruby-forum.com/.