3

I am trying to integrate live point data (worker locations) from Workforce for ArcGIS into a Javascript web app that I am building.

The layer loads fine and displays on the map properly, it even refreshes as soon as I zoom in or out, but it does not refresh automatically no matter what I try. I have tried using .refreshInterval and when I log the FeatureLayer it has the property set correctly but no refresh happens.

 esriId.registerToken({
 server: 'https://www.arcgis.com/sharing/rest',
 token: sessionStorage.getItem('token'),
 userId: sessionStorage.getItem('user')
 });
 var portal = new Portal({
 authMode: 'immediate'
 });
 portal.load().then(function() {
 var query = {
 query: 'title:workers_ AND access:shared AND type:Feature Service'
 }
 portal.queryItems(query).then(function(queryResult) {
 workers = new FeatureLayer({
 title: 'Workers',
 refreshInterval: 0.1,
 portalItem: queryResult.results[0]
 });
 workers.when(function() {
 workers.makeTemplate();
 console.log(workers);
 });
 map.add(workers);
 });
 });

I have also tried using

setInterval(function() {
 workers.refresh();
 console.log('hi');
}, 6000);

This logs hi every time but still does not refresh the layer. There are no errors of any kind in the console either. I have tried in both most recent Chrome and most recent Edge.

Does anyone know what the problem is/how to fix it?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Oct 19, 2018 at 20:39
1
  • 1
    Have you tried using a StreamLayer instead of a FeatureLayer? Commented Oct 19, 2018 at 20:57

1 Answer 1

5

This is a bug in the 4.9 JS API. It is in the queue for fixing in 4.10. We failed to implement refresh() using our WebGL-rendered FeatureLayer. It still works if you disable WebGL, but I don't recommend that approach since we plan to only support WebGL rendering in the future. This was oversight on our part, and we plan to resolve it shortly. Sorry about that.

answered Oct 22, 2018 at 16:04

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.