[Georuby-devel] find_by methods

Chris Ingrassia Chris.Ingrassia at fortiusone.com
Thu Apr 27 17:00:43 EDT 2006


I hope there are at least one or two people monitor this list, or  
this is all for naught :)

	I'm working on some projects and applications that GeoRuby and the  
spatial database adapters fit rather neatly into, and I'm reaching  
the point where it's probably going to be in my best interests to  
spur things along a little bit by taking a crack at extending GeoRuby/ 
MySQL with spatially-enabled find_by_* features, which I'm assuming  
would be of interest to just about anybody using the spatial database  
adapters for obvious reasons.

	I was just sort of curious what people's thoughts were on how they  
should be implemented.  You'd obviously want to try and stay as rails- 
like as possible, but I'm not quite sure what a simple line of code  
like :

	"MySpatialModel.find_by_geometry(Point.from_x_y(0,0))"

	should really mean.  Where the geometry is equal to that point  
(which I guess is what the strict rails-like way of doing it would  
be)?  Where that point is within the model's geometry column?  They  
both seem almost equally correct to me.

	When you get to things like finding things closest to a specified  
geometry, or that cross a specified geometry, etc... it starts to get  
a little hazier to me.

	My initial thought would be to do something along the lines of:

	"MySpatialModel.find_all_by_geometry_crosses(some_line_string)"

	and

	"MySpatialModel.find_by_geometry_nearest(some_other_geometry)"

	I feel sort of like I'm missing something really obvious and that I  
may got mocked for even asking such questions, but what that obvious  
thing might be eludes me at the moment, and these sorts of things  
keep me up at night.

	Any thoughts?




More information about the Georuby-devel mailing list