Hoppa till huvudinnehållet

How does one read a CSV file from a filePicker?

Kommentarer

13 kommentarer

  • Permanently deleted user

    It is not built into Geocortex Workflow. This has been traditionally a server side activity.

     

    We (DDS) are in the process of publishing geoWidgets Conversion Activities to extend Geocortex Workflow 5 with client-side file conversion activities to import and export shapefiles, spreadsheets, text delimited files, and KML/KMZ in Web GIS.

     

    We previewed this several weeks back at the Geocortex Partner Summit. We are working on an official listing on ArcGIS Marketplace that should be availabe this week. The functionality will include:

     

    geoWidgets Export Activities

    • Features to KML - Features to KML converts an Esri FeatureSet to a KML file object.
    • Features to Shapefile - Features to Shapefile converts an Esri FeatureSet to a Shapefile file object.
    • Features to Spreadsheet - Features to Spreadsheet converts an Esri FeatureSet to a variety of spreadsheet (.XLS, .XLSX, and .ODS) file objects.
    • Features to Text Delimited - Features to Text Delimited converts an Esri FeatureSet to a text delimited (.CSV, .TXT, .DAT, etc.) file object.
    • Save File - Save File activity allows end users to download the file objects created in the previous activities.
    •  

    geoWidgets Export Activities

    • Spreadsheet to Features - Spreadsheet to Features converts a user uploaded spreadsheet (.XLS, .XLSX, and .ODS formats) an array of Esri FeatureSets for use in Web GIS applications.
    • Text Delimited to Features - Text Delimited to Features converts an Esri FeatureSet to a variety of spreadsheet (.XLS, .XLSX, and .ODS) formats).
    • KML to Features - Coming soon...
    • Shapefile to Features - Coming soon...

     

    Documentation and workflow examples can be found at https://www.geowidgets.io/en/docs/geowidget-conversion-activities-geocortex-workflow-5/#features-to-spreadsheet.

     

    I will let you know when it is available but if you need access immediately, please contact me directly.

     

    Best,

    -Tom

     

     

    0
  • Stefan Schweigert

    Hi JD,

     

    The upcoming release of Workflow Server at the end of October, you will be able to easily read files and interact with their contents within the workflow.

     

    Thanks, Stefan

    0
  • Tom Neer

    JD - We have published our geoWidgets Conversion Activities (https://marketplace.arcgis.com/listing.html?id=34cd4e6cf2114610961b99798f8d875c) on ArcGIS Marketplace. If you subscribe (free), you will have access to read and write CSV files. We have documentation and sample workflows (https://www.geowidgets.io/en/docs/geowidget-conversion-activities-geocortex-workflow-5/) .

     

    These Activities differ from the Geocortex solution as they are client-side and work with both the SaaS and On-Prem versions of Geocortex Workflow. They are a beta release and during the beta support requests will be free. We would love to hear your feedback on our solution. -Tom

    0
  • Permanently deleted user

    @Stefan Schweigert?  Did the solution release at the end of October? If so, is there documentation on how to access the data and accomplish my original question?

     

    Thanks, JD

    0
  • Permanently deleted user

    This does help, and I am able to read the data and see the values in an alert. I still need help with how to pull only the values of a field in the csv.

     

    For instance, the csv comes in like:

    A,B,C,D

    1,2,3,4

    4,5,6,7

    8,9,0,1

     

    I want to pull all the values for C. So my end result would be "3,6,0". How do I get from the CSV values to just the values for C?

     

    Alternatively, would it need to be converted to JSON? If so, would the Convert To JSON activity work.

    0
  • Permanently deleted user

    JD, you will need to iterate the file. This can get a little messy, because each OS terminates lines differently. But you would want to split the text by '\r\n' (https://en.wikipedia.org/wiki/Newline) , then iterate the array and split by ',', then pull value from that array. Here's some psuedo code:

     

    file_lines = text.split('\r\n')

    for line in file_lines:

    # may want to skip the first line

    val = line.split(',')[2]

     

     

     

     

    0
  • Permanently deleted user

    @JD Burroughs? , did you get this to work? I have a similar issue. I am working with a CVS file with X,Y coordinates. I would like to create a workflow that would upload CSV file, read X,Y values from specified fields, and created point features from X,Y coordinates. And finally I would like to save the features to a feature class.

     

    Thanks,

    Nataliya

    0
  • Permanently deleted user

    Hey @Nataliya Lys? . We were able to work this out the issue above with a free extension that DDS (Digital Data Services) offers. However, I had also found a way to read the CSV. The problem for us was associating the field with the data. Since you're just handling X,Y you might be able to get away with it. Try the attached and see if that helps you out. I lost the code I had before so I just threw this together. Sorry that it's a little crude and probably full of errors.

    0
  • Permanently deleted user

    Hi @JD Burroughs?. Thanks for sharing your file. I will take a look and see if I can make any progress with this.

    0
  • Permanently deleted user

    Hi everyone, CSV could be hard as there's no spec. out of courtesy, how would you deal with values contains comma (or any char set as the delimiter), it's not a problem for numeric field like xyz, but in other field like comments, description etc. the often come with comma in the context.

    0
  • Permanently deleted user

    That is exactly the issue we had run into... filtering through all of the other fields. One option we considered was to have the user ensure their XY(Z) fields were the first columns in the spreadsheet and then cycle through them via their index. It was a little clunky and not the UX we wanted. However, I believe there are ways to create your own custom activities. I explored a few code samples out there that would probably work but we were under a time crunch and decided the DDS route fit our situation best.

    @DDS Technical Support?  has some free supplements for workflow that will help read excel files. This seemed to be the best option we found at the time.

    0
  • Tom Neer

    We handle parsing CSV and Excel files by having the user upload the file first. We read the headers or first line, then create a list. This is passed back to the user for them to map the fields to the appropriate inputs.

     

    For example, we have a geocoding workflow, where the user:

    • Uploads an Excel spreadsheet and the user defines the separator (comma is default).
    • We read the first line and parse the columns into a list
    • Open a Display Form to map out the columns, where we have 4 listboxes:
      • Address: <SELECT COLUMN>
      • City: <SELECT COLUMN>
      • State: <SELECT COLUMN>
      • Zip: <SELECT COLUMN>
    • The user maps out what columns to use
    • The spreadsheet is geocoded and the latitude, longitude, and reliability score are appended to the spreadsheet.
    • We also perform a spatial query an append sales territories after the geocode process
    • The Excel spreadsheet is presented for download to the user with the additional columns.

     

    Hope this helps.

    0

Du måste logga in om du vill lämna en kommentar.