Group By Field appears in the GeoJSON format settings, but does nothing.

My organization wants to join events to buildings in a one-to-many relationship, and serve this to a map overlay using Views GeoJSON. The event nodes have node references to the building nodes, which have geofields defining their location. Our target output is to have an array of values for each field when grouping is active. I'm currently looking into adding this functionality, but I haven't developed for Views before, and I'm still catching up on the API. Once I've finished, I'll submit a patch. If I'm not successful for whatever reason, the Group By option should be removed from the format options, as per the following:

views_plugin_style.inc, line 184:

Only fields-based views can handle grouping. Style plugins can also exclude themselves from being groupable by setting their "use grouping" definiton key to FALSE.

Comments

jeffschuler’s picture

Awesome; look forward to the patch. Thanks!

dericke’s picture

Update: we decided that Views Datasource was a better basis than Views GeoJSON. We didn't need valid GeoJSON, just WKT or X/Y somewhere in a JSON endpoint. Our fork is at https://bitbucket.org/wwuweb/views_datasource_wwu. I don't think it would be hard to port my changes to this module, but not understanding how the BBOX functionality works with grouping was a barrier.

Right now, the module works for our purposes, but the code is messy. There's at least one block of code that I copied from Views core without fully understanding what it does. Since this the first module development I've ever done, and it's been mostly through trial and error, it could probably stand to have a more experienced coder look at it. One major known issue: creating a label for the grouping field in the field options breaks the grouping.

jeffschuler’s picture

pol’s picture

Issue summary: View changes
Status: Active » Fixed

Status: Fixed » Closed (fixed)

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