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

ademarco’s picture

Let 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?

R.J. Steinert’s picture

StatusFileSize
new138.16 KB

It 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 :)

R.J. Steinert’s picture

Status: Active » Needs review
Issue tags: +proximity
StatusFileSize
new2.52 KB

Reduces 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.

R.J. Steinert’s picture

Title: Support for GEOMETRYCOLLECTION(POINT(lat, lon)) in exposed Location field » Support for WKT format in exposed/unexposed Location field
denny84’s picture

Hi 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

R.J. Steinert’s picture

PHP 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)

denny84’s picture

Hi,

Last time I must have done something wrong so I re applied the patch and this time this is what I get error

patching file views/openlayers_proximity_handler_filter.inc
Hunk #1 succeeded at 283 (offset 12 lines).
Hunk #2 succeeded at 327 with fuzz 1 (offset 20 lines).
Hunk #3 FAILED at 403.
1 out of 3 hunks FAILED -- saving rejects to file views/openlayers_proximity_handler_filter.inc.rej

So I opened the file openlayers_proximity_handler_filter.inc.re and this is what being logged

--- views/openlayers_proximity_handler_filter.inc	21 Sep 2010 15:17:30 -0000	1.1.2.12
+++ views/openlayers_proximity_handler_filter.inc	10 Oct 2010 20:59:03 -0000
@@ -403,4 +420,4 @@
     }
   }

-}+}
Something went wrong with line 403 .... gosh I am really terrible!!

Thanks