CSV Layer Multiple local files uploading

709
4
06-18-2020 03:00 AM
AminBangash
New Contributor

I am working on a project to upload multiple local csv files to csv layer via javascript api. Files are uploaded but only the first one is displayed. Can anybody help in this regard.

0 Kudos
4 Replies
UndralBatsukh
Esri Regular Contributor

HI there, 

Please take a look at this simple test app. I am adding two csvlayers to the view in this app.

Hope this helps, 

-Undral

0 Kudos
AminBangash
New Contributor

thanks Undral for your response. My scenarion is a bit different, i.e i am uploading multiple csv files and click on a upload button with file uploading code and pass it to a method like

public attachFiles(files){

let urlArray=[ ]

for (let i=0; i<files.length; i++){

files.item(i)

urlArray.push(URL.createObjectURL(files));              // pushing files like example.csv

}

urlArray.forEach(rec=>{

if(rec){

this.csvLayer.url=rec;

this.csvLayer.qeryFeatures().then(function(response){

addGraphipcs(response)   // drawing graphics for features

}

}

})

}

it works for one csv file, but i need to upload multiple files locally, anybody have idea how to do that. 

0 Kudos
UndralBatsukh
Esri Regular Contributor

I am not clear what you are trying to achieve. You are replacing the url of your csvlayer and the last url will win. You should be create a new csvlayer. 

this.csvLayer.url=rec;

0 Kudos
AminBangash
New Contributor

Hi Undral,

I have an upload button for uploading multiple local  files on local drive(no http url) with lat long, and i am trying to plot all csv files via csv layer. How to do that, what's the best , either i have to merge multiple csv files into one csv file and then plot it or all can be combined and draw at a time by single csv layer. Your response will be appreciated.

0 Kudos