GoogleMaps plugin marker setOptions error There's something that I'm missing in the migration from smartMaps to GoogleMaps. I have a series of points that represent different types/outcomes/modes of transportation crashes. I'm setting options on the markers and then trying to push that back into the googleMaps markers.
This worked with smartMaps but my JS-skillz are not super strong and I'm getting an error:
Example:
Uncaught TypeError: Cannot read property 'mapAlpha.5981.address' of undefined
What am I missing here?
 {% set locations = craft.entries.section('crashes').all() %}

  {% set options = {
    id: 'mapAlpha'
  } %}

  {{ googleMaps.map(locations, options).tag() }}

  &lt;script&gt;

    var crashMarkers = Array();

    {#  Loop through entries and add settings to markers #}
    {% for entry in locations %}
      var markerId = 'mapAlpha.{{ entry.id }}.address';

      // Uncaught TypeError: Cannot read property 'mapAlpha.5981.address' of undefined

      googleMaps.marker[markerId].setOptions(
          {
              'icon': '{{ icon }}',
          }
      );

      crashMarkers.push(googleMaps.marker[markerId]);

    {% endfor %}

&lt;/script&gt;
Icon management is handled a bit differently in the new Google Maps plugin. Now, you set icons before the map is rendered, even in Twig!

Official guide for Setting Marker Icons

{# Get all bars &amp; restaurants #}
{% set bars        = craft.entries.section('locations').type('bars').all() %}
{% set restaurants = craft.entries.section('locations').type('restaurants').all() %}

{# Create a dynamic map (with no markers) #}
{% set map = googleMaps.map() %}

{# Add all bar markers #}
{% do map.markers(bars, {
    'icon': '/images/bar-icon.png'
}) %}

{# Add all restaurant markers #}
{% do map.markers(restaurants, {
    'icon': '/images/restaurant-icon.png'
}) %}

{# Display map #}
{{ map.tag() }}