1

I have a content type with latitude and longitude coordinate fields. i have a view that is displayed on each page with this content type, and a google map plotting the location. Is there any way to sort a view using the distance between points?

distance=( ( current_page_lat - view_item_lat) + ( current_page_lng - view_item_lng ) )

1 Answer 1

0

You will need help of views_php module. This module will help to sort views rows with a calculation. You need to go through.

But in your case, The calculation has a value from current page. So you have to get the current page value (lang, lat) in sorting field, may be you can use it as a global variable or call a function from inside the php field.

Hope this helps you. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.