OpenWaterFoundation / owf-app-infomapper-ng

Open Water Foundation InfoMapper web application for menu-driven maps and visualizations, using Angular
GNU General Public License v3.0
1 stars 2 forks source link

Add save button for the attribute table #278

Closed Nightsphere closed 3 years ago

Nightsphere commented 4 years ago

Add a Save button to save the full table (or selected rows, when selected functionality is added) to a file, such as CSV, and maybe Excel file. In this case, the original map layer is not being saved, but the extracted attribute table. If saving to CSV, it is appropriate to replace nulls and NaN with spaces.

smalers commented 3 years ago

I recommend waiting on this until some of the other Save buttons are added to dialogs. Then circle around and decide whether this will save only table (similar to time series table save) or also allow saving the layer, such as GeoJSON. Can always point the user back to the original file similar to issue 299.

See the TSTool DataTable.writeDelimitedFile](https://github.com/OpenCDSS/cdss-lib-common-java/blob/master/src/RTi/Util/Table/DataTable.java) method for an example of writing a generic table.

smalers commented 3 years ago

My feedback:

  1. For the filename to save, can the original geojson file name be determined and swap out the extension with csv? That would give a connection back to the original data.
  2. Not sure what to do for a web service. Maybe set a property on the layer such as saveFile. Maybe need to be more specific such as saveFileCsv or saveFile.csv? If we allow saving other file types with different extensions this could be an issue.
  3. We'll have to reevaluate when dealing with rasters such as GeoTiff.
smalers commented 3 years ago

My feedback:

  1. Add a tooltip for the Download button with Download layer data table to csv file.
  2. I saved Colorado Counties table and the filename was Colorado Counties...csv, which is cumbersome. I recommend using the geoLayerId value with .csv appended. The name will often be too verbose and have spaces, which makes files more difficult to deal with. A variation on sourcePath might also be used, but for URLs this is ambiguous. I think geoLayerId is probably the best option at this time. We could also add attributeTableSaveFile property in which case attributeTable is appropriate for map configuration since it is more technical, and it would be equivalent to "data table" that the user sees. This would be a properties property, not built-in. The default if this property is not found is the geoLayerId value.
  3. Are the built-in and properties properties all being shown?
smalers commented 3 years ago

My feedback:

  1. The csv file formatting needs to be updated. Currently all column values are quoted. Only date/time and string value columns should be quoted. The original Java example code handled this.
  2. Also, quote all column headings since they are strings.
  3. Test with Excel and TSTool ReadTableFromDelimitedFile command.
Nightsphere commented 3 years ago

The changes have been merged for the formatting, and tested with Excel and TSTool. Closing the issue.