Smart Map - Output map locations from relationship file in a matrix I have "locations" section where each entry is a location, with a Smart Map field for the address.

I have another section "pages", where I have a matrix field which contains an entry relationship field, where I can select entries (locations) from the first channel.

I'm trying to output a map of all locations selected in my matrix field, but I'm getting an error:
Property "Craft\SmartMap_AddressModel.title" is not defined.

I'm using the code below to get the address fields from the individual entries, and put them into an array. I think maybe I'm not understanding what exactly needs to be in the locations array:

{% set locations = [] %}

{#  loop though all relationship fields for this entry #}
{% for block in entry.pageBuilder.type('listingGroup') %}

    {#  loop through related entries #}
    {% for member in block.listing %}

        {# get individual entry address #}
        {% set address = member.address %}

        {# add entry address to locations array #}
        {% set locations = locations|merge([address])%}

    {% endfor %}
{% endfor %}

{{ craft.smartMap.map(locations, options) }}
At a glance, your code looks perfect... but I think there's a subtle error. The locations parameter can be an array of elements, but you are building an array of Address fields (which is not valid).

https://plugins.doublesecretagency.com/smart-map/render-a-map-in-twig/


You can simplify the middle part of your code to this:
{# add entry to locations array #}
{% set locations = locations|merge([member]) %}

That way, locations will end up being an array of elements.