Hello,
I play today with geo and the distance filter. The filter don't completely work specially when it is exposed or without any value.
Note: "Fribourg" is a city of Switzerland...
Geo filter distance (widget: Google API Postal) without any value:
Return any result. In the query we have think like that "X(field_geocode2_geo) - ))"
#Query
SELECT node.nid AS nid
FROM node node
LEFT JOIN content_type_geo_test2 node_data_field_geocode2 ON node.vid = node_data_field_geocode2.vid
WHERE (node.type in ('geo_test2')) AND (SQRT(POW((111206 * (X(field_geocode2_geo) - )), 2) + POW((111206 * (Y(field_geocode2_geo) - )), 2)) < 8000) AND (Within(field_geocode2_geo, GeomFromText('POLYGON((-0.0719385644659 0.0719385644659, 0.0719385644659 0.0719385644659, 0.0719385644659 -0.0719385644659, -0.0719385644659 -0.0719385644659, -0.0719385644659 0.0719385644659))', 4326)))
#error:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')), 2) + POW((111206 * (Y(field_geocode2_geo) - )), 2)) < 8000) AND (Within(fiel' at line 4 query: SELECT node.nid AS nid FROM node node LEFT JOIN content_type_geo_test2 node_data_field_geocode2 ON node.vid = node_data_field_geocode2.vid WHERE (node.type in ('geo_test2')) AND (SQRT(POW((111206 * (X(field_geocode2_geo) - )), 2) + POW((111206 * (Y(field_geocode2_geo) - )), 2)) < 8000) AND (Within(field_geocode2_geo, GeomFromText('POLYGON((-0.0719385644659 0.0719385644659, 0.0719385644659 0.0719385644659, 0.0719385644659 -0.0719385644659, -0.0719385644659 -0.0719385644659, -0.0719385644659 0.0719385644659))', 4326))) LIMIT 0, 10 in /XY/sites/all/modules/views/includes/view.inc on line 755
Geo filter distance (widget: Google API Postal) with city as Fribourg:
No error :) and every things to be work good. Correct node as returned.
#Query
SELECT node.nid AS nid
FROM node node
LEFT JOIN content_type_geo_test2 node_data_field_geocode2 ON node.vid = node_data_field_geocode2.vid
WHERE (node.type in ('geo_test2')) AND (SQRT(POW((76122.2276654 * (X(field_geocode2_geo) - 7.151281)), 2) + POW((111206 * (Y(field_geocode2_geo) - 46.802503)), 2)) < 8000) AND (Within(field_geocode2_geo, GeomFromText('POLYGON((7.07934243553 46.8744415645, 7.22321956447 46.8744415645, 7.22321956447 46.7305644355, 7.07934243553 46.7305644355, 7.07934243553 46.8744415645))', 4326)))
Geo filter distance (widget: Google API Postal) with the Field EXPOSED:
Exposed filter seem don't work...
#with any value in the exposed filter
Error:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')), 2) + POW((111206 * (Y(field_geocode2_geo) - )), 2)) < 8000) AND (Within(fiel' at line 4 query: SELECT node.nid AS nid FROM node node LEFT JOIN content_type_geo_test2 node_data_field_geocode2 ON node.vid = node_data_field_geocode2.vid WHERE (node.type in ('geo_test2')) AND (SQRT(POW((111206 * (X(field_geocode2_geo) - )), 2) + POW((111206 * (Y(field_geocode2_geo) - )), 2)) < 8000) AND (Within(field_geocode2_geo, GeomFromText('POLYGON((-0.0719385644659 0.0719385644659, 0.0719385644659 0.0719385644659, 0.0719385644659 -0.0719385644659, -0.0719385644659 -0.0719385644659, -0.0719385644659 0.0719385644659))', 4326))) LIMIT 0, 10 in /XY/sites/all/modules/views/includes/view.inc on line 755.
Query:
SELECT node.nid AS nid
FROM node node
LEFT JOIN content_type_geo_test2 node_data_field_geocode2 ON node.vid = node_data_field_geocode2.vid
WHERE (node.type in ('geo_test2')) AND (SQRT(POW((111206 * (X(field_geocode2_geo) - )), 2) + POW((111206 * (Y(field_geocode2_geo) - )), 2)) < 8000) AND (Within(field_geocode2_geo, GeomFromText('POLYGON((-0.0719385644659 0.0719385644659, 0.0719385644659 0.0719385644659, 0.0719385644659 -0.0719385644659, -0.0719385644659 -0.0719385644659, -0.0719385644659 0.0719385644659))', 4326)))
#with Fribourg as a city in the exposed filter
Error:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')), 2) + POW((111206 * (Y(field_geocode2_geo) - )), 2)) < 8000) AND (Within(fiel' at line 4 query: SELECT node.nid AS nid FROM node node LEFT JOIN content_type_geo_test2 node_data_field_geocode2 ON node.vid = node_data_field_geocode2.vid WHERE (node.type in ('geo_test2')) AND (SQRT(POW((111206 * (X(field_geocode2_geo) - )), 2) + POW((111206 * (Y(field_geocode2_geo) - )), 2)) < 8000) AND (Within(field_geocode2_geo, GeomFromText('POLYGON((-0.0719385644659 0.0719385644659, 0.0719385644659 0.0719385644659, 0.0719385644659 -0.0719385644659, -0.0719385644659 -0.0719385644659, -0.0719385644659 0.0719385644659))', 4326))) LIMIT 0, 10 in /XY/sites/all/modules/views/includes/view.inc on line 75
query:
SELECT node.nid AS nid
FROM node node
LEFT JOIN content_type_geo_test2 node_data_field_geocode2 ON node.vid = node_data_field_geocode2.vid
WHERE (node.type in ('geo_test2')) AND (SQRT(POW((111206 * (X(field_geocode2_geo) - )), 2) + POW((111206 * (Y(field_geocode2_geo) - )), 2)) < 8000) AND (Within(field_geocode2_geo, GeomFromText('POLYGON((-0.0719385644659 0.0719385644659, 0.0719385644659 0.0719385644659, 0.0719385644659 -0.0719385644659, -0.0719385644659 -0.0719385644659, -0.0719385644659 0.0719385644659))', 4326)))
Geo filter distance (widget: Google API Textfield) with fribourg int texfield:
Return any result. Why display the address and not only the Textfield? In the query we have think like that "X(field_geocode2_geo) - ))".
#Query
SELECT node.nid AS nid
FROM node node
LEFT JOIN content_type_geo_test2 node_data_field_geocode2 ON node.vid = node_data_field_geocode2.vid
WHERE (node.type in ('geo_test2')) AND (SQRT(POW((111206 * (X(field_geocode2_geo) - )), 2) + POW((111206 * (Y(field_geocode2_geo) - )), 2)) < 8000) AND (Within(field_geocode2_geo, GeomFromText('POLYGON((-0.0719385644659 0.0719385644659, 0.0719385644659 0.0719385644659, 0.0719385644659 -0.0719385644659, -0.0719385644659 -0.0719385644659, -0.0719385644659 0.0719385644659))', 4326))
#error:
* warning: mb_strlen() expects parameter 1 to be string, array given in /XY/includes/unicode.inc on line 404.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')), 2) + POW((111206 * (Y(field_geocode2_geo) - )), 2)) < 8000) AND (Within(fiel' at line 4 query: SELECT node.nid AS nid FROM node node LEFT JOIN content_type_geo_test2 node_data_field_geocode2 ON node.vid = node_data_field_geocode2.vid WHERE (node.type in ('geo_test2')) AND (SQRT(POW((111206 * (X(field_geocode2_geo) - )), 2) + POW((111206 * (Y(field_geocode2_geo) - )), 2)) < 8000) AND (Within(field_geocode2_geo, GeomFromText('POLYGON((-0.0719385644659 0.0719385644659, 0.0719385644659 0.0719385644659, 0.0719385644659 -0.0719385644659, -0.0719385644659 -0.0719385644659, -0.0719385644659 0.0719385644659))', 4326))) LIMIT 0, 10 in /XY/sites/all/modules/views/includes/view.inc on line 755.
Comments
Comment #1
gagarine commentedOK!! geo filter seem to work fine if the goespatial cck field don't use geocode as widget but only long/lat.
Comment #2
allie mickaHi Gagarine,
This is an old issue. Can you confirm it's fixed?
Thanks!
Comment #3
gagarine commentedYep I think it's fixed I will try in some day to finish writing http://listentothis.net/drupal/geocoding-et-recherche-de-proximite-avec-... so if something go wrong I open a new bug because the SQL certainly change.