Hi Chi
I have good news, or at least some good news, about this. I was able to reproduce this issue and found what is causing it. Let me explain it:
By default, when filtering by a DECIMAL value in a custom field, WordPress needs to know the number of total numbers and decimal places that the values are using. If we do not pass that information, it defaults to decimal values with a maximum of 10 digits and 0 decimal values. This means that it does not filter by decimals at all, and also that it rounds the passed values upwards, so filtering by 22.1 <= x <= 23 becomes filtering by 23 <= x <= 23 (and 21.9 <= x <= 23 becomes 22 <= x <= 23).
So the solution is quite simple: pass the amount of decimal places that our values can take, and that is all. In your case, as latitude and longitude can have values of 3 integer digits, and can hold up to 6 decimal places, we need to pass the value (9, 6).
Unfortunately, Views does not have a way to pass that values at the moment,and it is quite difficult to add it to our GUI right now. We will have to find an easy way to implement this, maybe only asking for the number of decimals and implementing the maximum for the overall number of digits, not sure at the moment. But s a workaround our next version is going to implement a filter so you can adjust that values with a little piece of code. In fact, the example that we will show in our documentation will be exactly this one that you need to implement.
I can send you a patch on this to your email, if you want. Once you implement it, you need to add the following code to your functions.php file or to wharever you are adding your custom code:
add_filter('wpv_filter_custom_field_filter_type', 'prefix_my_decimal_filter', 10, 3);
function prefix_my_decimal_filter($type, $meta_name, $view_id) {
if ( $type == 'DECIMAL' && $view_id == 646 ) {
$type = 'DECIMAL(9,6)';
}
return $type;
}
Hope it helps. Let me know if I should pass you the patch or you will wait to our next release.
Regards,
Juan de Paco