Problem loading Google Maps satellite map in a map question | XM Community
Skip to main content

Hello,

I have a map question in my Quatrics survey, using Google Maps JavaScript API. By default the "roadmap" map appears, but I want people taking the survey to have the option to switch to the “satellite” map. When I switch to the satellite map I get a message saying that there are no images available for that location, but that is not true.

I copy the code I am using below. When entering this line:

mapTypeId: 'satellite',

I have managed to get it to display the “satellite” map for a second, but then it disappears and displays the message that there are no images available. The 'roadmap' option still works fine.

 

I have this code in the header section:

 

<script async src="https://maps.googleapis.com/maps/api/js?v=quarterly&key=MY_API_KEY"></script><script src="https://unpkg.com/qualtrics-google-map-lat-long@2.0.1/dist/QualtricsGoogleMap.min.js"></script>.

Where it says "MY_API_KEY", I put my key.

 

And this code in the map question:

 

Qualtrics.SurveyEngine.addOnload(function().

{

/*Place your JavaScript here to execute when the page loads*/.

initGoogleMapsQuestion(this.questionId, this.getQuestionContainer(), {

  // Map Options, set these! See Map Options in Option Documentation Section

  options: {

    center: {lat: -46.05, lng: -72.1833333333,},

    zoom: 9,

    mapTypeId: 'satellite',

  },

  // Marker Options, set these!

  markers: t

    // First Marker

    {

      // See Marker Options in Option Documentation Section

      options: {

        title: "Marker 1",

        draggable: true,

        label: "1",

      },

    },

  ],

});

});

 

I remain attentive to your comments.

Thanks!

 

Be the first to reply!

Leave a Reply