1

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.

  • 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 '13 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 '13 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 '13 at 3:14
  • what service layer I should add for this csv data? – Joe Zou Jul 11 '13 at 3:16
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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