Set OrderBy on Grouped Query Involving Smart Map Field I'm working with a Structure of resort locations. Each resort has a field address which is a Smart Map field. I'm trying to create an initial display page that groups the resorts based on their state (a Smart Map address part), but I would like to order the output first based on the state and then by resort title.
Something like.

Arkansas
Awesome Place
Best Place
Alabama
Alright Place
Better Place
Florida

I'm partially there using the following:
{% set resorts = craft.entries().section('resortsList').orderBy('title ASC').all() %}
{% set resortsByState = resorts|group('address.state') %}

And then outputting the list...
{% for state, resortsInState in resortsByState %}
  &lt;h2&gt;{{ state }}&lt;/h2&gt;
  {% for resort in resortsInState %}
    &lt;p&gt;{{ resort.link }} - {{ resort.address.state }}&lt;/p&gt;
  {% endfor %}
{% endfor %}

This gives me the list grouped by the state and ordered by the resort title which gets me partially there. I've tried adding address.state as part of the ordering declaration, but I'm only getting errors (Unknown column 'address.state' in 'order clause'). Is there a proper way I should be doing this?
Okay, I've been able to solve this and figured I'd share what I discovered. The key for each group is the value of the state so really what I was after here was a key sort and just didn't realize it. So I found Michael Rog's "SuperSort" plugin which has a twig filter for running a ksort and that addressed it perfectly for me making a small adjustment to use supersort in the response.

{% set resorts = craft.entries().section('resortsList').orderBy('title ASC').all() %}
{% set resortsByState = resorts|group('address.state')|supersort('ksort') %}


I'm interested in other solutions too that don't require a plugin, but this particular direction got things going for me.