0

I am having trouble getting it views to calculate the distance. I want a current user to see the distance to other users however the only result I have gotten is 0 between users.

I tried to follow this and still got no result:

Looks pretty straightforward using geofield 7.x-2.0-alpha2:

I assume you have geofield and geophp enabled and assume you have added a geofield to your users that get the location from an addressfield.

create a view of type users add "[name of your geofield] - proximity" field select "source of origin", I tried "exposed geofield proximity filter", check the "round" box add "[name of your geofield] - proximity" exposed filter and select a "source of origin point" as well. For example, add a "geocoded location" (fancy word for address) add that same field to your sort options to sort by proximity as well. In your example you would probably change the "source of origin point" to "current user".

I have checked the users address and they create points. Do anyone have an idea how to get it to work?

3
  • 1
    By "no result," what do you mean? You'll need to provide more details about what steps exactly you have taken. The original instructions as posted by MotoTribe work; I have done the same myself. Jan 9, 2013 at 15:21
  • Okay, by no result I mean the proximity field in views show 0 in distance.. I followed the instruction from MotoTribe as well but when configuring the field to be proximity i can se an error in the background: SQLSTATE[42000]: Syntax error or access violation: 1582 Incorrect parameter count in the call to native function'RADIANS' --> when/and before it is saved the distance show zero for each user Jan 9, 2013 at 18:21
  • apparently there is a new realease under way fixing some bugs Jan 9, 2013 at 18:54

2 Answers 2

2

I just posted a new documentation page for geofield that shows how to setup a basic proximity search: http://drupal.org/node/1944648

2
  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – mpdonadio
    Jan 2, 2014 at 13:05
  • 1
    Even though it's preferable to post at least a snippet here, I'm upvoting him just appreciate his (own) great writing in d.o docs. No offense intended, @MPD
    – AKS
    Jan 2, 2014 at 13:53
1

At first I also received only zeroes in the proximity field.

I had created an addressfield field for user location, as well as a geofield field which used that addressfield to store geocoded data.

In views, I set the "Geocoded Location - proximity" settings to: Round: [checked] Source of Origin: Current User Source Field: [name of geocoded user field]

Still zero; I returned to my test user page and manually entered a location (rather than relying on Smart IP/automatic geolocation) and saved the data.

I also succeeded in adding a contextual filter for User Location: - Selected filter: Global: Null - Selected "Provide Default Value" for "When the filter value is NOT in the URL:" - For Default Value type, selected in dropdown menu: Visitor location attribute (via IP Geolocation) - For "Location attribute to use," selected "Postal Code."

After updating user data and adding the contextual filter, I received non-zero results for the proximity field.

However, deleting the filter did not change results, so I believe it was the newly-saved user data that made a difference.

Hope this helps in your troubleshooting.

1
  • you said However, deleting the filter did not change results, so I believe it was the newly-saved user data that made a difference. What are you trying to say?
    – Umair
    Oct 16, 2019 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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