Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've created a map on ArcGIS online, adding a layer by uploading a csv file. This works fine, see map at link http://www.arcgis.com/home/webmap/vi...1ba43a0256c06b.

Now I'm trying to simulate this in JavaScript API. First I create a Web API service that returns the same data set I've got in csv file. This is published on my local webserer. In my web page, I create a webmap, adding a layer that references this web API:

 function init() {
 var options = {
 basemap: "gray",
 center: [153.115672, -30.296312],
 zoom: 14
 }
 var mapServiceURL = "http://[myserver]/TRWDataManagerAPI/API/OzRegs";

 // Create map and call Init function
 map = new esri.Map("mapDiv", options);

 map.addLayer(new esri.layers.ArcGISDynamicMapServiceLayer(mapServiceURL));
 }
 dojo.ready(init);

The webmap is displayed, but the layer doesn't have any effect. What's missing? Am I at the right track? Your help is greatly appreciated.

share|improve this question
The link to arcgis online is broken. Secondly, can you share the CSV, or at-least it's format? And you can't use the CSV as ArcGISDynamicMapservice. It is not a Dynamic MapService, and it won't work. – Devdatta Tengshe Jul 11 at 3:04
Hi Devdatta, Thanks so much for replying. the link is arcgis.com/home/webmap/…. CSV file like this: – Joe Zou Jul 11 at 3:13
POSTCODE COPIES POPULATION LATITUDE LONGITUDE 2450 15360 33378 -30.296312 153.115672 2455 1513 2605 -30.496629 153.020778 2456 7286 11742 -30.110777 153.199564 – Joe Zou Jul 11 at 3:14
what service layer I should add for this csv data? – Joe Zou Jul 11 at 3:16

1 Answer

You need to look at the three samples present here: CSV

If you look at the code, you will see that what they do, is to programmatically parse the CSV, and then add the data as graphics to the map.

There is no inbuilt class that will create a Layer for you from a CSV.

share|improve this answer
Thanks! I'll look into it. – Joe Zou Jul 11 at 3:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.