Terms:

Distance - distance of a particular location (node) from a given point (address, zipcode etc).
Radius - arbitrary number (miles, kilometers etc) stored in a content field.

Description:

I had a client recently who wanted to calculate the difference between the distance of an establishment from a given point and the delivery radius of that establishment (stored in a field) in order to determine if delivery is available. That is, if (Distance - Radius) < 0, then that establishment would deliver to the entered point and it would be in the view results.

To solve this problem, I wrote a views handler that allowed the client to create a filter that would do basic arithmetic using a geofield proximity field (Distance) and an arbitrary numeric field (Radius). This allowed the client to filter on (Distance - Radius) < 0.

My question is:

Did I even have to write custom code to achieve this? And if I was correct in choosing to write custom code, would this code be useful as an addition to the module?

I see it as a filter that would allow someone to perform basic arithmetic (+, -, *, /) using a proximity field and another numeric field.

I could submit a patch...

Comments

jerry’s picture

Issue summary: View changes

I'd be interested in seeing your work on this, even if not in patch form.