简体   繁体   中英

HERE Maps API JavaScript for Qualtrics

I am trying to insert a HERE Map API into a Qualtrics variable using JavaScript. I have tried to insert code into the JavaScript of a short text variable to bring up my HERE map using my HERE API that is all set up with the services needed, but nothing is showing up when I preview the survey. I am trying to determine where in the Qualtrics code I can return the map so it appears in the survey variable.

If anyone has any input/advice/code, I am all ears! Thank you!

This is the code I have in the header (under general settings):

src="https://js.api.here.com/v3/3.1/mapsjs-core.js" type="text/javascript" charset="utf-8"

src="https://js.api.here.com/v3/3.1/mapsjs-service.js" type="text/javascript" charset="utf-8"

This is the code I have in the javascript:

    var platform = new H.service.Platform({
       'apikey': '{MYAPIKEY}' 

  }); 



  // Obtain the default map types from the platform object 

  var maptypes = platform.createDefaultLayers(); 



  // Instantiate (and display) a map object: 

  var map = new H.Map( 

    document.getElementById('mapContainer'), 

    maptypes.vector.normal.map, 

    { 

      zoom: 10, 

      center: { lng: 13.4, lat: 52.51 } 

    }); 

Two things you should try if you haven't already:

  1. Put your JS code inside the Qualtrics addOnload function.
  2. Add a div with the id mapContainer to your question text (use HTML View)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM