AnsweredAssumed Answered

How to show the new earthquake every minute?

Question asked by ohlasd on Feb 21, 2020
Latest reply on Feb 25, 2020 by ohlasd

I am studying arcgis javascript and I saw a few examples using geoJson from USGS to mark the earthquakes globally.

USGS claims that the past hour geoJson file is updated every minute so I want to only mark the new earthquake every minute. How should I do it? Should I save the ids from the past hour geoJson file in the last minute and find out the new earthquakes by comparing ids from last minute to ids from current minute (earthquake ids are unique)? or should I check the time of the earthquake? which way sounds better or any other simple way?

This is the code to load the past hour earthquake:

const geojsonLayer = new GeoJSONLayer({
          url: url3,
          copyright: "USGS Earthquakes",
          popupTemplate: template,
          renderer: renderer //optional

This is how I will reload USGS url every 60 seconds:

         window.location.reload(1); //refresh all
         //map.getLayer("geojsonLayer2").refresh(); //refresh only one
      }, 60000);

Then I hesitate whether to query the time of the earthquake or query the ids to find out the new earthquake.

Thank you!