Comma-separated Value files (CSV) and text files can be added from local files or referenced from URL locations on the Web. An interesting feature of adding CSV and text files via URL locations is that each time you open your map, or otherwise refresh the map or layer, the data is udpated from the source. This means that if the CSV or text file has changed, the map will reflect those changes. Let’s take a closer look at how this works.
An example – earthquakes
The USGS Earthquake Hazards Program Feeds & Notifications site posts continually updated data in a variety of formats, including spreadsheets (CSVs). The CSV files record earthquake lat/long, magnitude, and other details, and are updated at frequent intervals. Note that Recent Earthquakes are also found in the Living Atlas, and the use of USGS earthquake CSVs here is primarily illustrative.
Below we’ve located the CSV file containing earthquakes recorded for the past hour on the USGS Earthquake Hazards Program Spreadsheet Format website. The file is updated every 5 minutes.
Right-click the link to copy the file location (the screen capture shows Chrome options, your browser may be different):
To add the layer to your map click Add, then Add layer from Web:
From the dropdown list choose A CSV file, paste the URL obtained in the step above into the URL input box, then click Add Layer.
The locations of earthquakes are read from the CSV file (which is physically located on the USGS website) and displayed on the map. Below is the saved map after we changed the basemap and quake symbols. We can see a handful of quakes in California and neighboring states, plus another in Hawaii.
Later in the day, we opened the map again. When the map is opened, the CSV file is read from the source (the USGS site) and our layer is refreshed. We can see right away that since we last viewed the map that a new earthquake has occurred in Alaska, and that the quake in Hawaii and several near California are no longer shown, since they’ve fallen out of the 1-hour time capture of the CSV:
Setting a refresh interval
In the example above, the earthquake data is refreshed each time the map is opened. However you can set a specific refresh interval for the layer. In this case we know from the information posted on the USGS site that the CSV is updated every five minutes, so we can set the layer to refresh at 5-minute intervals to match.
To set a refresh interval, open the layer options:
And choose Refresh Interval, entering the desired time in minutes:
The layer refresh interval is saved with the map, and updates will occur as specified wherever the map is used (in apps, embedded in websites, etc.).
The updates described using URL-based CSVs only occur when using lat/long locations, and not when using addresses. If symbolizing on values in the CSV (using color, size, or unique values), new values and ranges not previously within the source file will not be displayed unless symbol styles are reapplied.
For more information see the following:
This post was originally published on December 7, 2011, and has been updated.