1

I have created a city engine web scene,and I am trying to display the 3d-visualisation view on sceneview by using the portal Item Id of my webscene. But I am getting

SyntaxError: Unexpected token ILLEGAL

How to solve this?

<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
 <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
 <title>Load a basic WebScene - 4.0beta3</title>
 <style>
 html,
 body {
 margin: 0;
 padding: 0;
 }
 </style>
 <link rel="stylesheet" href="https://js.arcgis.com/4.0beta3/esri/css/main.css">
 <script src="https://js.arcgis.com/4.0beta3/"></script>
 <script>
 require([
 "esri/views/SceneView",
 "esri/portal/PortalItem",
 "esri/WebScene",
 "dojo/domReady!"
 ], function(SceneView, PortalItem, WebScene) {
 var scene = new WebScene({
 portalItem: new PortalItem({
 id: "022290763bc243bbb5329c879e1dbd3a"
 })
 });
 var view = new SceneView({
 map: scene,
 container:"viewDiv"
 });
 });
 </script>
</head>
<body>
 <div id="viewDiv"></div>
</body>
</html>
PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jan 5, 2016 at 13:25

1 Answer 1

2

Your code is in fact correct. We can see this because changing the portal ID to the one from the sample code like so:

var scene = new WebScene({
 portalItem: new PortalItem({
 id: "51c67be4a5ea4da6948a40210ddfab1a"
 // use to be 022290763bc243bbb5329c879e1dbd3a
 })
 });

Works as expected. As such it must be something to do your portal item. Due to the fact that the ArcGIS JavaScript API is minified/obsfucated it is quite hard to deduce why this is happening. The common cause of ILLEGAL token is to do with rogue characters in JavaScript/JSON. The full explanation can be seen here. Some things to check:

  1. Is the item shared to publicly on your Portal/ArcGIS Online?
  2. What does your scene contain exactly? Is there anything unusual in there that may be causing the error?
answered Jan 5, 2016 at 14:35

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.