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.

Devdatta Tengshe
41.8k37 gold badges147 silver badges267 bronze badges
asked Jul 11, 2013 at 2:49
4
  • 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. Commented Jul 11, 2013 at 3:04
  • Hi Devdatta, Thanks so much for replying. the link is arcgis.com/home/webmap/…. CSV file like this: Commented Jul 11, 2013 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 Commented Jul 11, 2013 at 3:14
  • what service layer I should add for this csv data? Commented Jul 11, 2013 at 3:16

1 Answer 1

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.

answered Jul 11, 2013 at 3:22
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.