AnsweredAssumed Answered

Bring portal map in html file

Question asked by mshah12 on Nov 26, 2018
Latest reply on Nov 28, 2018 by rscheitlin

Hello,

 

I am trying to use the JS API v. 3.22 to bring my portal map into an HTML div in my index.html file. I am receiving a dojo call back error but when I click on the error it takes me to my portal where after the sign in and certificate recognition, I can see my map so I'm not sure why it is not able to show up in my index. If the authentication is the issue and if anyone else has run into that and can point me in the right direction on how to handle that and modify my code below (I've also attached it as a JS file below) I would greatly appreciate it.

 

When I go to the webmap in portal it does require me to recognize my certificate twice and ask me to sign in (all three of the steps are attached as screenshots below).

 

var map;
var newMap;

require([
"dojox/mobile",
"dojo/parser",
"dojo/dom",
"esri/map",
"dojo/domReady!",
"esri/arcgis/Portal",
"dojo/_base/connect",
"esri/urlUtils",
"esri/arcgis/utils"],
function(mobile, parser, dom, Map, Portal, arcgisPortal, connect, urlUtils, arcgisUtils){

parser.parse();

var portal = new arcgisPortal.Portal("https://servername/arcgis/"); //this works because we have connect as a function now
connect.connect(portal, 'onLoad', function() {
console.log("portal: ", portal);
console.log(portal.defaultVectorBasemap);
});
var newMap;

arcgisUtils.arcgisUrl = "https://servername/arcgis/";
console.log("after arcgisUtils.arcgisUrl");
arcgisUtils.createMap("769582fc23364618b2d3cee42aa67d0e", "viewDiv").then(function(response){
console.log("response: ", response);
newMap = response.map;
});
console.log("after createMap");

map = new Map("viewDiv",{
basemap: newMap,
center: [-122.45, 37.35],
zoom: 13
});

});

 

 

Thank you so much for any help.

Outcomes