Search by location doesn't work
lsabug - March 29, 2007 - 16:16
| Project: | location (API, module) |
| Version: | 5.x-3.x-dev |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Description
Hi,
I've installed location.module and have enabled it for my user profile. I am collecting street, city, state, zip, country. I also have gmap installed. When I perform a location search and look for a zip and country I just entered I get no results. I was wondering if this was because the location information was in the profile section rather than a node. So then I created a node and enabled locative features. Did another search and again it returned no results even though I know I just entered the data I was searching for. I ran cron just to make sure it was all indexed but no dice.
Anyone have search by location functioning with location and gmap modules enabled?
Thanks.
Lsabug

#1
Did you install the zipcode database per the instructions in Location?
#2
Yes, that was one of the first things I did. Thanks for the reply.
Lsabug
#3
Search by Location is not functional for me, either.
I have enabled the geocoding data and updated the search index.
-Ben
#4
It turns out I hadn't added the zipcode information to the database. This isn't done automatically, you have to follow the instructions in install.txt.
In order to load the data on the remote server, where I didn't have access to /bin/mysql,
I converted the .sql file into a .csv ,uploaded it, and used the query LOAD DATA LOCAL INFILE in a php script.
It works now.
#5
Is there a way to perform a Search by Location using the geocoding function, i.e. NOT using the zipcodes?
Since geocoding allows for an address to be identified as a long / lat array, it would be more powerful to use it than to use huge zip code files...
Examples of such calculations can be found here :
http://www.google.fr/search?q=distance+between+two+points+latitude+longi...
So the basic idea would be to keep the "Search by Location" form as it is now, but to only replace the zipcode field by a standard address.
Maybe this functionality is already available?
#6
I had the same problem. Then when I was messing around in views I managed to create a zipcode search and it worked there. ???
There are tutorials around regarding views and searches if you need to go that route.
#7
this might help http://drupal.org/node/208265
#8
I did a fresh drupal-5.7 install with location module 5.x-1.x-dev.. I have the zipcode db and it is populated for US zipcodes. I added my address information on my profile. I can do mysql queries and see my zipcode exists in the zipcode table and the location table. The "by location" search returns nothing for me though. I tried upgrading to 5.x-2-7 and still got nothing. Then on 5.x-2.7 I would get mysql bad syntax back like so:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(n.nid)) AS count FROM node n INNER JOIN location l ON n.vid = l.eid WHE' at line 1
Looking at the sql statement it posted there was an extra DISTINCT in there..
SELECT COUNT(DISTINCT DISTINCT(n.nid)) AS count FROM node n INNER JOIN location l ON n.vid = l.eid WHERE l.type ='node' AND l.latitude > 32.7196692862 AND l.latitude < 35.6141427138 AND l.longitude > -120.09287287 AND l.longitude < -116.59444713 AND (IFNULL(ACOS(0.827405095235*COS(RADIANS(latitude))*(-0.47475900455*COS(RADIANS(longitude)) + -0.880115837603*SIN(RADIANS(longitude))) + 0.561605562987*SIN(RADIANS(latitude))), 0.00000)*6371368.96766) < 160934.7;I grep'd the location module code and that extra DISTINCT does not exist. Must be something with the db sql fct wrappers.. because if you take away that extra DISTINCT the sql runs fine. Granted it returns 0 when it should return 1.. which brings me back to the main point of posting in this thread and not starting another thread. I reverted back to 5.x-1.x-dev to focus on why i get 0 results since I was getting that 'DISTINCT' problem above..
A reason that "By location" search is returning no results is because if you look at that sql it is inner joining the table node to location where location.type = 'node'.. if you look at the location table there is one record of my address in there with a location.type of 'user'.... So unless you have 'node' location.types the information will not come back as a query result which is probably why when the views/nodes location tracking comes into play users start seeing results. i.e. take the above sql minus the extra distint and change l.type='node' to l.type='user' and you will get a result count of '1' from mysql in my scenario.
mysql> SELECT COUNT(DISTINCT(n.nid)) AS count FROM node n INNER JOIN location l ON n.vid = l.eid WHERE l.type ='node' AND l.latitude > 32.7196692862 AND l.latitude < 35.6141427138 AND l.longitude > -120.09287287 AND l.longitude < -116.59444713 AND (IFNULL(ACOS(0.827405095235*COS(RADIANS(latitude))*(-0.47475900455*COS(RADIANS(longitude)) + -0.880115837603*SIN(RADIANS(longitude))) + 0.561605562987*SIN(RADIANS(latitude))), 0.00000)*6371368.96766) < 160934.7;
+-------+
| count |
+-------+
| 0 |
+-------+
mysql> SELECT COUNT(n.nid) AS count FROM node n INNER JOIN location l ON n.vid = l.eid WHERE l.type ='user' AND l.latitude > 33.8050967766 AND l.latitude < 34.5287152234 AND l.longitude > -118.78094318 AND l.longitude < -117.90637682 AND (IFNULL(ACOS(0.827405095235*COS(RADIANS(latitude))*(-0.47475900455*COS(RADIANS(longitude)) + -0.880115837603*SIN(RADIANS(longitude))) + 0.561605562987*SIN(RADIANS(latitude))), 0.00000)*6371368.96766) < 40233.68;
+-------+
| count |
+-------+
| 1 |
+-------+
1 row in set (0.00 sec)
Then looking at the code in location.module where it prints "Your search yielded no results." you would make it past that and get printed results.. which is what we would expect...
I am brand new to drupal, so go easy on me.. this is where I am and I figured I would post now what I have found out so far hoping someone can shed some light...
#9
subscribe
#10
subscribing
#11
subscribe
#12
i found the GCG module with the GMAP module a great replacement for locations module
http://drupal.org/project/gcg
http://drupal.org/project/gmap
and
the patch from http://drupal.org/node/227491 to use views with proximity searching
#13
Found my solution:
Problem:
Did not initially enable geocaching. Then after adding my venues, I noticed to enable the geocaching, and found it not working
Explanation:
It did not start to work, because the geocaching info for each venue is generated at time of save.
Solution:
I don't see an auto generate all geocaching info for each available venue, but it only appears to require me to enter the edit window for each item, then select save, to trigger the generation of that info.
#14
I'm having some weird user access control issue with the "Search by location" function of the Location module. When I'm logged in as the admin, everything works great - however when other users attempt to use it, all they receive is the number of results WITHOUT any actual results listed.
"Displaying results 1 - 0 of 11 for search on 49508" - Yet no results!
I have every user box checked for the "search content by location" area in the Access control admin menu. It seems like this is some user access problem since the search works for the admin but I can't find any other privileges that controls this besides the "search content by location".
Any help would be greatly appreciated!!!
If you want to see the issue in action go here: http://ratethismuseum.com/search/location
#15
bump...
Has no one else ever had this problem with the location search not displaying results for other users besides the admin?
#16
Hey there planet guantlet
What is your view set to display? Maybe try full node to start with?
Then are you using any interesting joins node-ref or anything combined to make the view?
--
On this page : *******/admin/settings/location
Toggle location display:
-- Disable the display of locations.
-- Enable the display of locations.
"If you are interested in turning off locations and having a custom theme control their display, you may want to disable the display of locations so your theme can take that function."
--
#17
I have the "Enable" option selected under the "Toggle location display:" under admin/settings/location but as far as I can tell there is no view for the "search by location" page. The page becomes available after enabling the option for users under the "Access Control" setting.
#18
subscribing
#19
This should be up and running again in 3.x in a minimal way in DRUPAL-5--3 CVS.
Additional fixes will be applied as issues are found.
#20
Okay, thanks for the reply...I'll upgrade to 5.x-3.x-dev asap.
#21
Automatically closed -- issue fixed for two weeks with no activity.
#22
I've got 5.x-3.0-test3 installed...
and I do have the zipcodes imported into my correct, prefixed table...and still with either the location search (/search/location), or with a custom usernode-userlist view, using the "User Location: Proximity" filter.
so I'm just bummfuzzled now...
screenshots attached...and I do have user's locations which have zipcode 27302 filled out...so it "should" work...I would have thought anyway...
any help please :)
#23
Marking as duplicate of #319278: [master][meta] Location_search rewrite.