Location / distance based calculated field in views results? Modules in use:


Drupal 7.12
Views 3.3
Location 3.x-dev
(and lots more of course)


I have a pretty standard view which has a user entered proximity filter for distance from a zip code, used to shows stores near a certain location (your standard dealer/store locater search). I would like to add a calculated field (or something) to show how far each store is from the entered zip code. This field would only be used in the view, and would not need to get saved to the node it represents, since this distance will change depending on the entered zip code.

Can anyone point me in the right direction?

Thanks!
I guess I should have looked through the module better. Here's the answer (tip: it's built right in!):


Go to your view (it needs to be a node based view I think)
In the "fields" section choose "add"
In the search box type "distance" and then choose the "Location: Distance / Proximity" field
Choose miles or kilometers to suite your needs
Then choose "Use Distance / Proximity Filter" from the drop down list (assuming, like me, you have an exposed filter in your view for users to enter a distance and a zipcode)
Adjust the label if you'd like, then click "apply"
In the "sort criteria" section, choose "add"
In the search box type "distance" and then choose the "Location: Distance / Proximity" field
Then choose "Use Distance / Proximity Filter" from the drop down list (assuming, like me, you have an exposed filter in your view for users to enter a distance and a zipcode)
Choose descending (most likely, anyway) and if you want to expose it, then you can click that check box also


And that does it!