Needs review
Project:
Geofield
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Jun 2012 at 22:51 UTC
Updated:
13 May 2023 at 15:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Brandonian commented@joelinvisible, can you provide an export of your view?
Off the cuff, I suspect that it's an issue with null values in your geocoded data, but I don't have anything to back that up yet. Do you have any blank Address fields with your data?
Comment #2
joelinvisible commentedHi @Brandonian, thanks for your help, here's my views export:
Comment #3
Brandonian commentedThis should be fixed with the commit I did today for #1614344: Make input optional in proximity searches - fix for Notice
http://drupalcode.org/project/geofield.git/commit/8e1ff0e
If this isn't the case, please reopen.
Comment #5
johnlutzLooks like this problem resurfaced after you revamped your filter handler code in late 2012. Uploaded a patch which solves the problem for me. Issue was that on initial display there were empty latitude and longitude values in $options array.
Comment #6
jlporter commented#5 - agreed, have same issue. Patch did not apply cleanly but I replicated your fix against our repo and it fixed the issue.
Comment #7
gianfrasoft commentedI already have the same problem.
Here is my view:
Comment #8
gianfrasoft commentedOk, I solved! Maybe my solution should help someone else... That is:
In my view I added the Geocode-proximity field to fields list. So I set the "Source of Origin Point" to "Manually enter Point" as was specified in a couple of articles online: Wrong!
Solution:
"Source of Origin Point" have to be set to "Geocoded Location"!!!
P.S. I'm using latest module version, the one published on GIT.
Comment #9
callums commentedI got stuck with this error for a couple of hours but finally figured out my issue.
It seems the "Geocoding Service" drop down for the proximity exposed filter reverts to "KML" after the view is saved.
When the view is saved I need to make sure that "Google Geocoder" is selected instead of "KML".
Comment #10
mgiffordWould be great if there were some warning or alert rather than a strange error message.
@gianfrasoft & @sleepyscene have different solutions.
Is it now safe to use this with the latest stable release (7.x-2.0)?
I do hope that there's no need to keep using the git version.
Comment #11
stopshinal commentedI have both a map and list view. I'm trying to apply a 'sort' so the nearest location is show first in the list. I'm not sure I can include a 'distance' field - otherwise I could sort on that. Does anyone have any ideas on how to implement a sort like this?
Comment #12
bneil commentedI received this error after setting my "Source of Origin Point" to "Manually enter Point" and did not provide a default value. Once I added a default value, the error was gone.
I agree with mgifford, it would be nice to have some sort of notice instead of the error. Setting to needs work re: comment 6.
Stopshinal - There is a field-proximity sort handler available that you can use in conjunction with the exposed filter.
Comment #13
bneil commentedComment #14
bneil commentedHere's a rerolled patch that applies cleanly. However, it I still receive the error on view edit with the patch applied.
Comment #15
cmonnow commentedI have to sleep now so and I just lost the page once so sorry I have to be quick.
In geofield/views/proximityplugins/geofieldProximityManual.inc the function getSourceValue($views_plugin) is, on face value at least, meant to check whether a submitted value or otherwise the manual defaults have been set or not in $views_plugin->value and if not, simply return 0 (set previously in the page, $views_plugin->options['geofield_proximity_manual']['lon']).
The problem is (isset($views_plugin->value) is always true so if the values in $views_plugin->value['origin']['lat'] or $views_plugin->value['origin']['lon'] are not set mySQL will attempt a RADIANS function on ''. We can check it's not == ''. We cannot simply check !empty since lat/lng should be able to be 0.
I don't believe the previous patches should be performed since then all results will be shown if either the latitude or longitude is 0 (i.e. PHP's special definition of empty). This excludes a lot of equatorial countries and the people who lives exactly on Greenwich's longitude :)
I could be wrong but I need sleep now (I've already fixed the !empty part above after some rest :)).
I haven't check all the other plug-ins either.
Comment #16
cmonnow commentedComment #17
socialnicheguru commentedComment #18
mgiffordMoving this to "needs work" - the author of the last patch still reported "I still receive the error on view edit with the patch applied."
This does need to be reviewed though. The patch is over a year old and it's quite likely that other things have changed since then.
Comment #19
hypertext200This fixed the SQL error and the patch rolled from the suggestion at comment #15.
Comment #20
mgiffordComment #21
jumpthattb commented@gianfrasoft
Awesome! :)
Comment #22
afinnarn commentedI had an issue with this module containing the same error when the proximity location data was not filled in. My issue was with the manual filter plugin, and after applying this patch the errors went away.
For context, I am using the exposed filter to pass back data to the view after getting the current location of the user. If I put a default value in the filter, then on the first page load, the wrong data would be displayed...or if getting their data fails at least the default view without geolocation works and goes to a fallback.
So, since this patch works for me and seems to be a harmless change with just more error checking, I'm going to mark it as RTBC.
Comment #23
afinnarn commentedComment #24
afinnarn commentedForgot to say the patch I used was #19.
Comment #25
calefilm commentedI received this error after setting my "Source of Origin Point" to "Manually enter Point" and did not provide a default value. I don't believe I have a use case for this option but I just wanted to report that I received the error after successfully patching stable and dev versions.
Comment #26
poker10 commentedAs per #25, I think this needs more reviews.