I have multiple geotags assigned to nodes in a designated geospatial field.
I want to create a view which - for example - only shows the geotags within Spain and Portugal.
So I have created a view with display-fields: node-id, node-title, geotag-longitude and geotag-latitude.
Now I want to set a filter using the geotag field, using the "within" option, the widget "Well known text" and the term "POLYGON((-10.810546875 44.024421519659,3.779296875 43.389081939117,3.1640625 35.389049966912,-10.634765625 35.389049966912,-10.810546875 44.024421519659))" in the box.
I expect to receive in the hitlist only the geotags of Spain and Portugal, but the results list is empty.
The view works correctly when I remove the filter.
Comments
Comment #1
geoffff commentedI also tried something similar using "within" and a POLYGON, and got similar (empty) results.
Comment #2
ahtih commentedThis might be related to http://drupal.org/node/883032 so you can try the patch there.
Comment #3
martin.l commentedHave you found a solution for your requirement in the meantime? I have exactly the same requirement ...
Comment #4
KhaledBlah commentedIn the file includes/views/geo.views.inc (version: alpha5) on line 479 (function "geo_views_set_target") it says:
This appearantly leads to problems when using WKT other than POINT. When I use a POLYGON for instance (in a filter) and any of the target functions this will fail. If, however, I change it to
the filter will work as expected. Of course, I know that using 'wkt' twice as parameter causes geo_value to simply return the input value. So I am wondering with which intention the 'array' parameter was used here and what side effects this change might have.
Is there anyone who can enlighten me?
Comment #5
KhaledBlah commentedAfter doing some more testing it looks like the code change in #4 has side effects. The code above only works when the handler that calls the function the code is in is a filter handler. It doesn't work with field or sort handlers appearantly. It also doesn't work when the target is a lat/lon field.
So here is a new version that takes that into account. To apply it modify includes/views/geo.views.inc and replace line 479 with this: