Is there any particular reason why the views filter handlers for longitude and latitude are based on the numeric handler?

I needed sub-degree accuracy for a project, so I replaced them with float (child of numeric).

Files: 

Comments

hutch’s picture

Interesting, can you provide examples?

lotyrin’s picture

I'm using the extents from a GMap to filter a view that I have below the map in an Iframe (so that only pins showing on the map will have related data shown in the iframed view).

When the user is zoomed in too far, the extent of their currently viewed map will be less than a degree wide or tall, so, with truncated ints, that means they'll have no results in the iframe. Additionally, even when zoomed out, map pins near the edges of the map were getting truncated.

I think it would be fairly common to need sub-degree accuracy for any number of other reasons.

hutch’s picture

What I mean is where did you alter code to achieve this? I don't see lats and lons as int anywhere, for instance in

location_views_handler_filter_proximity.inc

a snip of SQL from the above handler in Views

(location.latitude > 52.3579618789 AND location.latitude < 52.5380050593 AND location.longitude > -3.68825012953 AND location.longitude < -3.39284604281)

Locations are stored with 6 decimal places, that's roughly 10 centimeters or 4 inches
The SQL here is using accuracy of 1/100 mm
That's a lot more accurate than the resolution of google maps which I would estimate as between 1 and 5 meters at full zoom.

lotyrin’s picture

Status:Active» Needs review
StatusFileSize
new702 bytes

I'm not using the proximity filter, but rather separate filters for latitude and longitude.

I've prepared a patch of my changes.

lotyrin’s picture

StatusFileSize
new702 bytes

My last file upload seems to be broken? (links to "http://drupal.org/files/issues") trying again.

hutch’s picture

Category:feature» bug
Issue tags:+bug fix

Yes, you are quite right, these fields should be float. The SQL generated in views_handler_filter_numeric.inc uses %d, we need %f here, views_handler_filter_float.inc provides that.

Changing this to bug report

hutch’s picture

I would like to remind the maintainers of this patch in #5, it makes sense programatically, lat/lon should be of type float. If anyone is in a position to test this please do!

YesCT’s picture

Tagging

m0d’s picture

I tested it, works great for me.

YesCT’s picture

Status:Needs review» Reviewed & tested by the community
rooby’s picture

Status:Reviewed & tested by the community» Fixed

Status:Fixed» Closed (fixed)
Issue tags:-location bdragon check, -bug fix

Automatically closed -- issue fixed for 2 weeks with no activity.