My goal is to allow users to make a point on a map and get a proximity search back. I get close by doing the following:
Edit my OpenLayer preset, go to Behaviors, check "Draw Features", check "Point", fill "Element ID" with "edit-circle-location".
This fills the exposed Location filter with a Latitude and Longitude in the following format: GEOMETRYCOLLECTION(POINT(lat, lon))
That's technically WKT format? Currently it seems that the Location field in the exposed Proximity filter only accepts Zipcodes. I'm going to dive into the code soon. Any help or suggestions would be greatly appreciated.
Comments
Comment #1
ademarco commentedLet me see if I've got your scenario: you have an exposed filter with id #edit-circle-location that will be filled in using the Openlayers behavior you refer to, after that you submit the search. If this is the case then it's not going to work because Proximity only accepts (at the moment) location names (can be zip code, but also a street address: it uses geocoding to fetch lat lng values) or a node having a location attached to.
Anyway, it would not be difficult to implement it since you already provide lat lng. Could you attach some screenshot?
Comment #2
R.J. Steinert commentedIt sounds like you understood me correctly. Attached is a screenshot. When the View loads, the Location field is empty. After selecting the Point tool on the map and placing a point on the map, the Location field is filled with the Lat and Long as seen in the screenshot.
I could write some javascript to remove the "GEOMETRYCOLLECTION(POINT(" and ")" characters, even though this could also be done in the backend. I just need to allow that Location field to accept Latitude and Longitude.
In the future it would be really cool if we could use the Path and Polygon tools to define a search area :)
Comment #3
R.J. Steinert commentedReduces unnecessary calls to google api (but will still call 2x if the filter is exposed due to the OL bug/requirement of adding exposed filters 2x). Will now accept WKT format as location in exposed and unexposed Proximity filter.
Comment #4
R.J. Steinert commentedComment #5
denny84 commentedHi RJSTATIC,
this is also what I want is to get exposed filter from WKT format rather than node or string, but after I apply your patch I am getting php 500 server error..i am not php coder so dont know if this could be a php version error.
Thanks
Comment #6
R.J. Steinert commentedPHP 500 error is a nondescript error. Check your server's logs to find out what is causing it.
A PHP 500 error may be (from http://www.cyberciti.biz/tips/http-error-500-internal-server-for-php-pag...)
A malformed php cgi script
An invalid directive in an .htaccess or other config file
Limitation imposed by file system and server software (for example php log file size set to 10Mb)
Missing php.ini (or cannot read php.ini file)
Comment #7
denny84 commentedHi,
Last time I must have done something wrong so I re applied the patch and this time this is what I get error
So I opened the file openlayers_proximity_handler_filter.inc.re and this is what being logged
-}+}
Something went wrong with line 403 .... gosh I am really terrible!!
Thanks