CSV Sample erroring in map add layer ...unable to test ...

425
4
04-11-2014 09:28 AM
DavidTakahashi
New Contributor
Hola Land of Red,

When I download https://developers.arcgis.com/javascript/jssamples/layers_csv.html, or visit the sandbox, run it and download, and then open the file in IE10, Firefox or Chrome, I am appear to be erroring in the call to add the csvlayer to the map.  However, the code does appear to work in the live samples area and sandbox.  I have checked that the url to the csv file is not being blocked.

I am trying to test whether I will be able to load a local csv file.  Once I get past the error, is there any reason I would not be able to load a file on the local file system?

Thanks
:confused:
0 Kudos
4 Replies
KenBuja
MVP Esteemed Contributor
Do you have a proxy set up? In the code there is this line:

urlUtils.addProxyRule({
    proxyUrl: "/proxy",
    urlPrefix: "earthquake.usgs.gov"
});
0 Kudos
DavidTakahashi
New Contributor
The index.html from the samples download, and the layers_csv.html from the sandbox download BOTH have the urlUtils.addProxyRule code.

When I try to debug into the map.addLayer(csv); line I get a 'The resource from this URL is not text: http://js.arcgis.com/3.9/' error...

Viewing the script in firebug gives me:


GET http://services.arcgisonline.com/ArcGIS/rest/info?f=json
   
200 OK
        88ms   
/3.9/ (line 159)
TypeError: 'toString' called on an object that does not implement interface DOMException.
   

Filtered chrome url chrome://firebug/content/console/errorMessageObj.js

(an empty string)
/3.9/ (line 205)
error: TypeError: 'toString' called on an object that does not implement interface DOMException.
error(a=
TypeError: Unable to draw graphic (null): 'toString' called on an object that does not implement interface DOMException.
   

Filtered chrome url chrome://firebug/content/console/errorMessageObj.js

)csv.js (line 31)
(?)(a=
TypeError: Unable to draw graphic (null): 'toString' called on an object that does not implement interface DOMException.
   

Filtered chrome url chrome://firebug/content/console/errorMessageObj.js

)/3.9/ (line 640)
(?)()/3.9/ (line 74)
(?)(a=
TypeError: Unable to draw graphic (null): 'toString' called on an object that does not implement interface DOMException.
   

Filtered chrome url chrome://firebug/content/console/errorMessageObj.js

)/3.9/ (line 74)
(?)(a=
TypeError: Unable to draw graphic (null): 'toString' called on an object that does not implement interface DOMException.
   

Filtered chrome url chrome://firebug/content/console/errorMessageObj.js

)/3.9/ (line 76)
(?)()/3.9/ (line 74)
(?)(a=
TypeError: Unable to draw graphic (null): 'toString' called on an object that does not implement interface DOMException.
   

Filtered chrome url chrome://firebug/content/console/errorMessageObj.js

)/3.9/ (line 74)
(?)(a=
TypeError: Unable to draw graphic (null): 'toString' called on an object that does not implement interface DOMException.
   

Filtered chrome url chrome://firebug/content/console/errorMessageObj.js

)/3.9/ (line 76)
(?)()/3.9/ (line 74)
(?)(a=
TypeError: Unable to draw graphic (null): 'toString' called on an object that does not implement interface DOMException.
   

Filtered chrome url chrome://firebug/content/console/errorMessageObj.js

)/3.9/ (line 74)
(?)(a=
TypeError: Unable to draw graphic (null): 'toString' called on an object that does not implement interface DOMException.
   

Filtered chrome url chrome://firebug/content/console/errorMessageObj.js

)/3.9/ (line 76)
(?)()/3.9/ (line 74)
(?)(a=
TypeError: Unable to draw graphic (null): 'toString' called on an object that does not implement interface DOMException.
   

Filtered chrome url chrome://firebug/content/console/errorMessageObj.js

)/3.9/ (line 74)
(?)(a=
TypeError: Unable to draw graphic (null): 'toString' called on an object that does not implement interface DOMException.
   

Filtered chrome url chrome://firebug/content/console/errorMessageObj.js

)/3.9/ (line 76)
(?)(f=
TypeError: Unable to draw graphic (null): 'toString' called on an object that does not implement interface DOMException.
   

Filtered chrome url chrome://firebug/content/console/errorMessageObj.js

)/3.9/ (line 638)
(?)()/3.9/ (line 74)
(?)(b=Object { deferred={...}, resolved=null, error=function(), more...}, d=function(), f=function())/3.9/ (line 76)
(?)(a=null, c=function())/3.9/ (line 76)
(?)(a=function())layers_csv.html (line 77)
(?)(c=Object { promise=Promise, ioArgs={...}, fired=1, more...})/3.9/ (line 636)
(?)(a=Object { url="http://earthquake.usgs.....0/summary/2.5_week.csv", handleAs="text", load=function(), more...}, b=Object { usePost=false})/3.9/ (line 641)
buildCSVFeatureCollection(a=Object { url="http://earthquake.usgs.....0/summary/2.5_week.csv", layerDefinition={...}, columnDelimiter=undefined})csv.js (line 31)
_initCSVLayer(b=Object { copyright="USGS.gov", outFields=[1]})CSVLayer.js (line 22)
constructor(b="http://earthquake.usgs.....0/summary/2.5_week.csv", a=Object { copyright="USGS.gov", outFields=[1]})CSVLayer.js (line 21)
(?)(a=Object { url="http://earthquake.usgs.....0/summary/2.5_week.csv", _url={...}, spatialReference={...}, more...}, b=["http://earthquake.usgs.....0/summary/2.5_week.csv", Object { copyright="USGS.gov", outFields=[1]}])/3.9/ (line 240)
(?)()/3.9/ (line 239)
(?)()/3.9/ (line 105)
(?)(Map=function(), CSVLayer=function(), Color=function(), SimpleMarkerSymbol=function(), SimpleRenderer=function(), InfoTemplate=function(), urlUtils=Object { urlToObject=function(), getProxyUrl=function(), addProxy=function(), more...})layers_csv.html (line 47)
(?)(a=Object { mid="require*_15", pack=0, executed=5, more...}, d=undefined)/3.9/ (line 32)
(?)()/3.9/ (line 32)
(?)(a=function())/3.9/ (line 32)
(?)()/3.9/ (line 32)
(?)()/3.9/ (line 34)
(?)(a=load )/3.9/ (line 39)
   

...(a)}));return d},generateDefaultPopupInfo:function(a){var b={esriFieldTypeDouble...

csv.js (line 31)
"Resuming debugger: error during debugging loop: TypeError: firstViewRangeElement is null"


Thanks for the speedy reply!!!!
0 Kudos
JonathanUihlein
Esri Regular Contributor
It's definitely a proxy issue.

You need to change the path for proxyUrl so that your application can find your proxy.

For example, when I downloaded the CSV sample from the sandbox, I too encountered an error when first trying to run the application. I was able to fix this issue by entering the correct path to my proxy.


    
   urlUtils.addProxyRule({
          proxyUrl: "../../proxy/DotNet/proxy.ashx",
          urlPrefix: "earthquake.usgs.gov"
        });
0 Kudos
JeffPace
MVP Alum
also, you cannot just run the file in ie/chrome, etc.. It MUST be run/hosted on a webserver.
0 Kudos