Track Widget Sandbox Code not working outside Sandbox

651
3
03-27-2020 05:37 PM
JaydeepMistry1
New Contributor II

Hello all,

Track widget simulation | ArcGIS API for JavaScript 4.14 

I am trying to write some code using the Track Widget functionality demonstrated in the Esri Sample above. It specifically uses an external js library to force a custom location for its geolocation service instead of the current location of the browser. I want to use this method to modify the sample code shown in the Track Widget simulation, however when I try to run the code outside of the sandbox, i keep getting an error in loading the custom js library. Error message listed below:

Error in my browser's console:

geolocate.js:1

Failed to load resource: net::ERR_FILE_NOT_FOUND

dojo.js:24

Error: scriptError: //2gis.github.io/mock-geolocation/dist/geolocate.js
at q (dojo.js:5)
at HTMLScriptElement.<anonymous> (dojo.js:23)

Running the demo in the sandbox works fine, but when I try to run it outside in a standalone html file, the demo code does not work at all.

Weird thing is that I can open the link to the file that the mock-geolocation file is stored in, but for some reason the script in the html cannot. Also even when I give it a modified url to the RAW location of the js library on GitHub, it then fails to recognize the functions of the library.

Please help! Thank you

Jaydeep

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Jaydeep,

  Strange I saved the file to a virtual directory on my webserver and used a https:// url for my webserver and it worked fine. Note. You can not use file:// url and make this work.

JaydeepMistry1
New Contributor II

Hi Robert,

Yes you are correct. I forgot to place the file into a webserver before viewing it.

While I have your attention, I what I am trying to achieve are a few things if you know how to do them or could recommend any examples that do them:

1. Animate a point smoothly from one location to another

2. Have the camera follow the point smoothly as it is moving

Right now in the Track Widget code, the geolocated point is moving instantly from one location to another, and I would like for that movement to be fluent. Also since the point is moving so instantly, the camera following the point is also forced to move quickly, I would like for both of their movements to be smooth. Do you know how to achieve that?

Thank you for the quick response.

Jaydeep

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jaydeep,

   Animation is coming to the 4.x api but not here yet.

0 Kudos