Add a csv layer to a downloaded web appbuilder app

1730
8
Jump to solution
03-30-2018 10:21 AM
BrandonPrice
Occasional Contributor

I want to programmatically add a csv layer to a web appbuilder app hosted on a web server. Any suggestions? I have seen some threads about revising the mapmanager.js file and using map.addLayer.

https://community.esri.com/groups/web-appbuilder-custom-themes?sr=search&searchId=173dde7f-9cdd-4446...

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Brandon,

   Hmm.. So your issue is that when you add a CSV from a url that is on a different server and then deploy the app you run into a cross domain issue and you need to use a proxy in your deployed app. Once I added http://www.dot.ca.gov to my proxy.config used in my hosted WAB app then the csv layer showed up fine.

View solution in original post

8 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Brandon,

Any reason not to sue the Add Data widget?

Add Data widget—Web AppBuilder for ArcGIS | ArcGIS 

0 Kudos
BrandonPrice
Occasional Contributor

Hello Jake:

The add data widget would only temporarily add the data to the app for only a single session correct? I would like to permanently add the csv later so that every user can already access the csv layer when they access the app. The ArcGIS online version of the app has the csv layers visible. The hosted version of the same app never loads the csv layer. That's why I wanted to see if it could manually re-added.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brandon,

   That is strange. I did a test and created a web map using some csv data and then added that web map to a WAB dev app and then downloaded the app and hosted locally on my web server and never has an issue with the CSV layer being accessible.

BrandonPrice
Occasional Contributor

This is one of the url's that only shows in the arcgis online wab and not the downloaded version:

http://www.dot.ca.gov/cwwp2/data/d7/cctv/cctvStatusD07.csv

I was trying to follow this to programmatically add the csv file:

https://community.esri.com/message/748814-add-and-remove-fetaure-layer-to-wab 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brandon,

   Hmm.. So your issue is that when you add a CSV from a url that is on a different server and then deploy the app you run into a cross domain issue and you need to use a proxy in your deployed app. Once I added http://www.dot.ca.gov to my proxy.config used in my hosted WAB app then the csv layer showed up fine.

BrandonPrice
Occasional Contributor

Thanks Robert. I guess I will reference https://community.esri.com/groups/technical-support/blog/2015/04/07/setting-up-a-proxy to set a proxy on the hosted server

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Yes.

0 Kudos
BrandonPrice
Occasional Contributor

I got this to show: 

Thanks Robert.

0 Kudos