oulah

Arcgis.com map service: URL and layer-IDs?

Discussion created by oulah on Oct 24, 2011
Hello,

First off: I'm not sure whether to place this under Arcgis.com Online or the Javascript API, so I apologize if it's in the wrong forum.

With that said, on to my questions: I am currently working on creating a customized wma based on the ArcGIS.com Map viewer (similar to the sample provided here. However, the reason that I need to create a custom WMA and cannot use a ready-made template from ArcGIS.com is that I want to include a Find Task-function (similar to the sample provided here.
Now, in order create this function I need to know two things; first how do I find out the URL of my created map service (see first code-snip)? For instance, I created a quick web map to help me illustrate my point (http://www.arcgis.com/home/webmap/viewer.html?webmap=1c47e1217e394c39abca16756786b1f7). Is that URL also the URL of the map service (I haven't been able to make that one work)?

Secondly, how do I find out the Layer-ID to use in the find parameters (see second code-snip)? Are layers on ArcGIS.com given IDs based on the order they were added?

//Create Find Task using the URL of the map service to search
findTask = new esri.tasks.FindTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/TaxParcelQuery/MapServer/");


        
//Create the find parameters
findParams = new esri.tasks.FindParameters();
findParams.returnGeometry = true;
findParams.layerIds = [0];
findParams.searchFields = ["OWNERNME1","OWNERNME2"];
findParams.outSpatialReference = map.spatialReference;


Edit: I fixed the broken sample-link, my bad!

Outcomes