I could never get the bounding box argument to work in 8.x-1.x branch - it never appeared as an option to even add it. This fixes that, simplifies the codebase a little, and works with both geofield and geolocation fields. It also provides the option to round the coordinates down to 2 decimal places which may help a little with cacheing SQL queries. It doesn't yet support lat-long fields or wrapping around the -180/180 degree lines.

You use it like you would any contextual filter, ie provide a default value from a Query parameter, and set the name of the query parameter to bbox.

No automated tests yet, but manually tested with both geofield and geolocation fields using leaflet.

Comments

alarcombe created an issue. See original summary.

alarcombe’s picture

StatusFileSize
new17.38 KB
pol’s picture

Assigned: Unassigned » pol
pol’s picture

Thanks I will review this asap.

vdsh’s picture

I just realized that I kinda duplicated your work with #3086063: Views bbox contextual filter not working, sorry about that (and that could have saved me quite some time!).
My patch doesn't have rounding capabilities but it has wrapping around the -180° line.

We should probably somehow do a merge of both & commit that to the latest dev.

jeffschuler’s picture

Assigned: pol » Unassigned
Status: Active » Reviewed & tested by the community
StatusFileSize
new16.53 KB

Thanks @alarcombe!

Rerolled for latest 8.x-1.x-dev, plus a few minor changes.

I believe this is working at least well enough to commit to dev (since what's in there doesn't work at all), which I'll do now.

@vdsh: I haven't checked out your version in #3086063: Views bbox contextual filter not working (yet). If you want to open a new issue with patch for adding wrapping around -180º/180º (and/or any other improvements from your version) that would be great. Thanks!

  • jeffschuler committed 05c7595 on 8.x-1.x
    Issue #2907055 by alarcombe, jeffschuler: Refactor bbox arg for more...
jeffschuler’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

vdsh’s picture

For anyone interested, wrapping patch is here: #3107187: Bounding Box argument: Support 360° wrapping and I also added latlon support in here #3107173: Bounding Box argument: Support latlon field