Authoring maps that update using CSV files

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 the CSV captures:

Setting an update 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.).

Considerations

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

This post was originally published on December 7, 2011, and has been updated.

This entry was posted in ArcGIS Online and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

4 Comments

  1. igeopr says:

    Thanks for the post. I successfully added csv text files referenced from URL locations as layers on the ArcGIS.com map viewer. However, when using the map with the ArcGIS app for Android mobile devices, these layers were not showing up. Should I be able to see these layers or will it work in the near future? Thanks.

  2. pmckinneyccpa says:

    I created a story map based upon a CSV file. People who try to open the web map component of the story map using the Android ArcGIS app are not able to open the map.

    However, it opens up fine on the iOS ArcGIS app and web browsers. Is ESRI aware of this issue?

  3. sdlmedioambiente says:

    Hi

    I use ArcGis online to create diferents maps.
    The source data is CSV file is hosted in my own hosting service.
    Recently i have changed of hosting provider and the url of my CSV is diferent.
    How i can change the url adress of csv file ???
    If i click on layers, only can download file, and not modify the url .
    Thanks a lot…