Closed (fixed)
Project:
OpenLayers Proximity
Version:
6.x-2.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
22 Sep 2010 at 13:27 UTC
Updated:
14 Mar 2016 at 09:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ademarco commentedLet's say I have a website where users insert their location on a map using the content type "location". A possible use case of Rules / OpenLayers Proximity integration is to notify all users when a new user has placed his location 1 km from their own. How do I do that?
First of all I need to create a view to filter out nodes that are distant not more then 1 km from a given point. To do that I just need to set the proximity filter to less the 1 km without worrying about the starting point: it will be completed automatically at runtime during the rule execution.
Now, using Rules, when a new node of type location is created I fire the action
"Notify nodes based on geographic proximity" selecting, as proximity filter, the views display I have just created. This action will fire a Rules event called "Node is notified based on geographic proximity" only for the nodes the views display returns.
After that I set up a new rule for the event "Node is notified based on geographic proximity" choosing to trigger the action of sending an email to the authors of the notified nodes.
As the module is still in development this approach could have some downsides I didn't think about, feel free to report ideas and suggestions to improve it.
Comment #2
itserich commentedThanks Antonio.
Your comments refer to a single node type, I have 3 node types with locations, and user profiles with locations, and my goal is to notify users based on their profiles of new nodes when the node is within a certain distance. So, the node type to be notified is different from the node type doing the notifying. That does not sound possible, because it appears all nodes must compare against all other nodes
However, I tried to follow your comments to understand how it works. This is what I did.
View - Display: Openlayers Data, Style:Openlayers data, Filter for node type and set proximity.
Attached View1 shows the proximity filter and View 2 shows the Style. I tried to replicate the regular expose proximity filters I use.
Rule - Rule Settings: Event - After Saving New Content, and Element: Do - Notify nodes based on geographic proximity
Attached Rule 1 shows the Notify Node (with an error message) and Rule 2 shows the two parts of the Rule.
Thanks for any info.
Comment #3
itserich commentedUploaded to new site and I think I got it to work. Can not get it to work on real site. Keep getting: "An illegal choice has been detected. Please contact the site administrator" when I try to add "Notify nodes based on geographic proximity" as a Do Action.
Attached are screen shots for anyone who might try it, from the working site, which is configured the same as the non working site...
I can not find any other functioning proximity alert modules, this is an important feature that people should be interested in.
Comment #4
itserich commentedAttached is a screen shot of a improper email alert in Rules, it notifies the author of the module which is not useful. So I guess I don't know yet if it is working or not, as prior authors are not being contacted.
Comment #5
ademarco commented@itserich: I tried but I cannot replicate. Would you pack all your settings into a feature http://drupal.org/project/features (ctypes, rulesets and views) and upload it here? I'll try to reproduce the error. A remark: you don't need the views display to be an Openlayers Data type in order for the proximity filter to work, since OL Proximity uses it just as a query builder any kind of display is ok.
Comment #6
itserich commentedHello Antonio and thank you.
Have not used Feature before but this is what I came up with.
#1 is the site with the error
#2 is the site without the error
# 2 was a restored backup of site #1 before attempting Rule.
Thanks and hope this is what you were asking.
Comment #7
ademarco commentedThat's what I needed thanks. After a quick try I didn't get any error, from any of them. Which version of Rules/Views are you running? Im running Rules 6.x-1.3 and Views 6.x-2.11.
Comment #8
itserich commentedSame versions.
I will go through each site's modules and see if there is a difference.
Thanks for your help.
Comment #9
itserich commentedThere were a few differences, but the cause of the error appears to be http://drupal.org/project/user_relationships 6.x-1.0-rc5
I had installed it recently and not used it yet so disabled it and can get back to Rules + Proximity.
Thanks for your help.
Comment #10
ademarco commentedComment #11
juve76 commentedantonio,
thanks for the great insight- i have hit a snap and hope you can help.
I have created a proximity view, which is used via gmap to display user nodes nearby based on geolocation. the question i have is how can i integrate this view into rules?
when I follow your the next step is where i hit a snag in your second paragraph:
I cannot seem to find the option "a new node of type location is created" and "Notify nodes based on geographic proximity".
is there something i've missed in the steps of creating the rule?
thanks!
Comment #12
Jarode commentedHow to do that in D7 ?
There's nor "Notify nodes based on geographic proximity" nor "Node is notified based on geographic proximity" within rules.
Which versions of views, rules, core etc are known to work
Thank you indeed.
Comment #13
marco van bemmel commentedIf you want to fetch a list of entities (users or nodes) in Rules, based proximity of a current entity? Try Views Rules. Just create a view as you like (with fields, relations, filters, etc) and use the Rules display.
In Rules you can add an action or a loop Collect view result rows.
Tip: For contextual filters you need to set also the Rules:parameters in the view. Use in the parameter integer instead of the entity type.
See comment
Hope this will help somebody.