True/False about using proximity search?

Events happening in the community are now at Drupal community events on www.drupal.org.
tinem's picture
  1. Gmap + Location can only functioning if you upload a zipcode database for the country and you can only search for zipcode not for address or city?

  2. Openlayers you don't need to upload any zipcode and you can search for zipcode, address, city?

Comments

Proximity search

beanjammin's picture

I'm not sure about Openlayers, if it does proximity search I think that would be interesting.

The last time I looked into it the only proximity search support that could be used with Gmap + Location was based on zipcodes. Faced with this restriction, which didn't work for me, I created a module that I've very recently checked in as a sandbox project (http://drupal.org/sandbox/Beanjammin/1207492) that does proximity searching using gmap, location, and location_node. Location data is added to a node with location_node (a submodule of location), the user entered search location is geocoded using google maps api to lat/long, and the results are displayed via gmap. This way you can search on anything that can be geocoded via google maps api, such as a street address, intersection, city, airport code, etc. The module needs some more work, but is already being used at http://mymacs.ca/storelocator.

OL and proximity

itserich's picture

OL does work with proximity. I began working with Drupal a year ago and tried all the mapping and proximity and yes, Location was hard for me to set up and uses zip codes for proximity which is relatively imprecise.

Here is the OL Proximity module: http://drupal.org/project/openlayers_proximity

It works great with Views. It is supposed to work with Rules, but I have not gotten it to work yet.

http://drupal.org/node/941130

OL Proximity is showing less than 200 users which is surprising to me given it is so useful and easy, once set up.

It would be great if more coders focused on it, a few tweaks could improve it a bit.

Not sure I understood the original question, but...

pdcarto's picture

I think the answers are True and True. As @itserich says, openlayers_proximity allows views sorted/filtered by proximity. If you also use openlayers_geocoder, you have everything you need - no zip code database needed. Read the Open Layers Proximity Tutorial.

Zipcodes are not necessary

wulff's picture
  1. False. You can choose to upload a zipcode database, but if no zipcodes are available, the module can use a geocoding web service as a fallback (you can choose which service to use on admin/settings/location/geocoding).
  2. True.

That is interesting

itserich's picture

Thanks for the update wulff. I was not aware Location now had a geocode option. A Geocode API seems easier to me than maintaining the zip code database. Is there any reason to not use it?

I appreciate OL Proximity but the development has not progressed much over the past year.

Currently with OL we use it plus Views to locate nodes within X miles, and it needs to be more precise than zip code.

An example is here:

http://petnotice.com/view/lostdogs

Proximity from node location

SkyWombat's picture

Hi itserich and all others reading this,

my choice for geocoding and displaying geo information was also OL. Now I try to figure out how to do a proper proximity search based on the current node's location. The ultimate goal is to have a view which shows all other nodes in the proximity of the node from which the view is called. I tried OL proximity, but cannot figure out how to fill the center for proximity searching based on the node from which I call the view. All I get to work is exposing the starting point, which is not a solution.

Do you, or anyone else, have some hints on how to solve/implement such a requirement for proximity searching?

Thanks a lot in advance

SkyWombat

Do you want a user to be able

itserich's picture

Do you want a user to be able to choose Node B and then be shown the other nodes within X distance displayed as a list?

I have not figured that out yet, though I am sure it is possible.

Currently I am stuck using an exposed filter, entering an address, and then seeing the nodes within X distance.

If you want to notify users when a node has been created within X distance of their location, this is the most relevant discussion I have come across, and I still have not figured it out. And it was started in Oct 2010. So it seems like things have stalled but I do not understand it, geolocation seems increasingly important, and all the pieces seem to be available.

http://drupal.org/node/941130

Yes, either showing the other

SkyWombat's picture

Yes, either showing the other nodes within distance X as list/map directly on Node B. Or have a link like "Travel tips close by" on Node B, which leads to a view that shows the list/map for all nodes with travel tips within distance X to Node B.

Hope this is clarifies my needs.

In case there is no solution with OL and OL proximity, is there any other module/combination of modules, which does the trick for such needs?

OpenLayers Proximity has two

itserich's picture

OpenLayers Proximity has two settings for Starting Location:

Get location from a string - which is what I use, and is entering the text of a street address
Get location from a node

For your use I would guess you would want Get location from a node but I have never figured out how to use it. Currently when I enable it, a select list of all nodes by title is displayed, which is not practical.

There are various discussions in the OL Proximity issues that might help, but I don't recall much recently.

Nearby nodes

wulff's picture

If you're using OpenLayers, you can use the "Proximity: Great-circle" filter and choose "Get location from a node", set the radius and choose a random node to start the search from. Add a "Node: Nid" argument to the view and enable the "Exclude the argument" option. If you want to display the view on an existing node, you can install the Views attach module and add a "Node content" display.

The final step to make this work is to modify the value of the filter before the view is added to the node. You can do this in an implemenation of hook_views_pre_view(): https://github.com/wulff/drupal-proximity/blob/master/openlayers_demo/op...

If you're using Mapadelic, you can use the "Location: Distance / Proximity" filter and choose "Node's Latitude / Longitude from views nid argument" as the origin. For this to work, you must add a "Node: Nid" argument to the view (and enable the "Exclude the argument" option to clean up the results) and select that argument in the filter configuration along with the location field you want to use. If you want to display the view on an existing node, you can install the Views attach module and add a "Node content" display. I have added an export of this setup to the mapadelic_demo feature at https://github.com/wulff/drupal-proximity

Thank you VERY VERY MUCH

itserich's picture

Thank you VERY VERY MUCH wulff

I have used Views but only with Fields and Filters.

Found the book Drupal's Building Blocks written in part by Earl Miles (Views' creator) so will learn how to use Arguments and hopefully be a better user.

Thanks for the tip.

Thanks a lot. I will take a

SkyWombat's picture

Thanks a lot. I will take a closer look in the next days and let you know any feedback.

ad 1) make that "true, but".

wulff's picture

ad 1) make that "true, but". i confused the geocoding happening on node creation with the actual search stuff. however, it turns out that adding support for geocoded proximity search is fairly easy. See http://groups.drupal.org/node/159584#comment-544719 for a way of doing proximity search with gmap and location.

Proximity search solutions?

tinem's picture

1.
@tinem
Gmap + Location can only functioning if you upload a zipcode database for the country and you can only search for zipcode not for address or city?

@wulff
False. You can choose to upload a zipcode database, but if no zipcodes are available, the module can use a geocoding web service as a fallback (you can choose which service to use on admin/settings/location/geocoding).

The reason why I made this 1. is because in these two videos they tell that you have to upload zip-files but if you don't need it I don't understand why they do it?
http://blip.tv/file/4330136 AND http://svendecabooter.be/blog/implementing-location-proximity-search-for...
In the danish forum a person ask'ed for help to make proximity search and she couldn't get it to functioning after following these two videos and that was what started me. She STILL hasn't found the solution so Wulff if you can show a site where it's used AND functioning it would be great, please?
So you can search for an address, city, zipcode and use proximity search with Gmap +Location?

I have made this http://beta.findtoilet.dk/ but with a lot of javascript files and a private module but still want to learn building proximity search with only drupal map modules and think it should be possible if we all help each other. A LOT of people keep asking for this possibility.

2.
Showing sites using OpenLayers for this would also be great.

Openlayers example site

itserich's picture

As to Openlayers, geocoding a node works just like Google Maps, as far as I can tell and I use it daily.

Enter any address or landmark, and if it can be found by Google it can be found in Open Layers.

http://maps.google.com/

The problem I have with it is the public has trouble using it. There is no submit button, which Google recently added (I think), the options simply drop down and should be selected. Telling people to wait 5 seconds and look for the correct option is too much to expect, at least in my experience. So, I geocode each node myself based on info provided.

To try proximity search with OL, you can try http://petnotice.com/view/lostdogs

Try 100 miles from Los Angeles California.

OL is EASY once it is set up. When I tried Location on a shared host and tried to FIND a zip code database, then upload it correctly, and maintain it, and then realize it is not precise (in the US at least some zip codes can cover dozens of miles / km) it paled compared to OL. But this was a year ago. I have an open mind, but testing various geocode options was one of my worst Drupal experiences.

Proximity Search

ccardea's picture

I also went with Openlayers for the geocoding and proximity search features which were not available in Location module at the time I was looking. I've bee disappointed by the failure of the Openlayers modules to have an official port to Drupal 7, which is why I decided to implement a new approach to mapping and proximity searching in Drupal 7. http://gnode.ccardea.com This is not quite ready for production use but hopefully will become available within the next few months.

Edit 7/25 I recently found out that some of the site was not working for anonymous users and the multipoint map would only display in Firefox. This has been corrected, so if you looked at this before and it didn't work, you might want to take another look.

Demo of proximity search using GMap and Location

wulff's picture

I've put together a small demo of how to do proximity searching with the Mapadelic modules GMap and Location (well, one way of doing it, at least).

You can download a feature containing all the settings specific to the demo from GitHub: https://github.com/wulff/drupal-proximity

A brief guide on how to configure the modules by hand is available at https://github.com/wulff/drupal-proximity/blob/master/mapadelic.md

A screenshot of the final result is available at http://www.flickr.com/photos/nidhug/5946763056

This configuration of the GMap and Location modules makes it possible to search on locations such as "4000" (postal code only) "4000 Roskilde" (postal code and city), and "Algade 42, 4000 Roskilde" (full addresses).

Great thanks for the tutorial and hard work

htalwala's picture

I have another question for you. Do you know if it would be possible to also create a filter that would list the zipcodes automatically that are within the search radius? This would be useful so if someone wanted to drill down further they could choose a specific zipcode that falls within the proximity search.

If you want to make it using

beltofte's picture

If you want to make it using a zip code database with Danish zip codes, can you download them from http://www.postdanmark.dk/cms/da-dk/files/postnummerfil.xls. Not sure what format you will need, but it should be easy to transform the Excel file into the correct format.

ivanstegic's picture

I had tinem reach out to me after she found a sandbox version of Store Locator, which is not 100% ready for prime time in the community.

Essentially, after being VERY frustrated not having a simple solution for a store locator, we built our own one that aims to be easy to setup and use and doesn't require anything but a Google Account. It's implemented live on http://superclean.com/where-to-buy -- it uses Google Fusion tables to store and do proximity searches and relies on it for location management as well. We have a public repo on Github, that we hope to push to Drupal.org's sandbox project just as soon as we feel it's ready. The repo is here: https://github.com/ten7/storelocator

The beauty about this module is that it will work globally without the need to know post codes, zip codes, or any of that. It relies on Google Maps to geocode the location you enter and on Google Fusion Tables to store and search. It's slick.

Note that this first version of the locator on Github is for D6 and though it should work just fine internationally, has only been tested in the US for now.

I believe the sandbox Store

beanjammin's picture

I believe the sandbox Store Locator module you are referring to is mine (http://drupal.org/sandbox/Beanjammin/1207492). It is being used in production here: http://mymacs.ca/storelocator

I would be interested in learning more about your own implementation and whether there is the potential to collaborate.

Backend

ivanstegic's picture

Nope, I wasn't referring to yours, I was referring to mine. Ha.

What backend are you using for yours? It looks like Google Maps, but how are you geocoding and storing that lat/lng info?

I'm using the node_locations

beanjammin's picture

I'm using the node_locations module (provided by location) for storing the nodes' location, it's google_geocode_location function for geocoding the initial search radius centre, and it's earth_latitude_range / earth_longitude_range / earth_distance_query functions for building a relatively efficient proximity search query, gmap for the google maps display, and the google maps api directly for the driving directions and geocoding any subsequent changes to the "you are here" marker location.

URL

ivanstegic's picture

And, here's the sandbox version on Drupal that she was referring to: http://drupal.org/sandbox/ivan.stegic/1220430

I'm not seeing any commits.

beanjammin's picture

I'm not seeing any commits. Can you ping me when you have something to show? I think some collaboration would make sense.

Github

ivanstegic's picture

Check the Github repo referenced earlier, the Drupal sandbox has nothing in it right now.

Mapadelic tutorial with Features AND without

tinem's picture

First a BIG thanks to wulff making these tutorials https://github.com/wulff/drupal-proximity. I had used a couple of days to get this to functioning and had a lot of trouble using all the code and Features and think it's because I don't use and understand Features enough but you can see it here http://www.tinemuller.dk/drupal/mapadelic_demo. But click the marker/link and you will see two maps. Don't think it should be like this.

So I made a NEW site with ONLY this map and NO Features and think it looks OK http://mapadelic.tinemuller.dk/mapadelic_demo and NOT two maps here.

I tried to figure out to use Gmap markers but can't get it to functioning on the map for both sites.

I have included StreetView in a CCK field after installing Link module and Back to map made with Custom links.

Maybe someone else has also tried these great tutorials and have an opinion?

The beauty of gnode

ccardea's picture

The beauty of gnode is that it's as easy to use as setting up a new content type. Creating a gnode is as easy as creating a regular node. The map views and list views are already set up. All you have to is point your browser to the right url. For the tabbed views you need a custom menu, but that's all you need.

Many locations

ivanstegic's picture

How do you easily manage 25,000 nodes if a site has that many locations?

Many locations

ccardea's picture

If you are talking about content management, my initial plan is similar to content management for nodes, probably with the addition a facility for individual users to manage gnodes they have created. This is an area that is still under development. If you have a site with a lot of locations, I would be interested in hearing about the kinds of things you would like to be able to do. Probably the best place to have that discussion is my sandbox issue queue. http://drupal.org/project/issues/1146278?categories=All

Edit: Sorry, I initially read this through an email. I see above that you have written a solution using fusion tables. I looked at Fusion tables briefly and my impression is that it moves the data storage out of your database and into a Google account, then you query the database over the web, right? I would also be interested to hear if you believe that has some advantages for large databases.

Many locations

ccardea's picture

For proximity queries on large datasets, gnode uses a two-stage process. The first stage uses indexed columns to select the data without touching the geometry. The second stage does great-circle proximity calculations on the subset that was selected in stage one. The proximity criteria can be combined with other criteria as well.

tinem's picture

Have any of you tried this tutorial https://github.com/wulff/drupal-proximity + https://github.com/wulff/drupal-proximity/blob/master/mapadelic.md and would like to share your experiences, please?

Those look like great

itserich's picture

Those look like great tutorials, truly well written and thorough.

It also looks like they are for D6, and I am content with OL for D6, have begun looking for D7 options.

Location and Mapping

Group organizers

Group categories

Wiki type

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: