ArcGISTiledMapServiceLayer layer = new ArcGISTiledMapServiceLaye("http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Average_Household_Size/MapServer"); map.addLayer(layer);
mIdentifyTask = new IdentifyTask("http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Average_Household_Size/MapServer");
When you are working with this sample there 3 changes necessary to make in order to make it work when you embed it in your application.1. Change the URLS = Which you have already done.2. you have to set the parameter layers through an Array. You have to specify which layer/layers of the map service you are accessing so change or alter this line "params.setLayers(new int[]{0});" in the curly braces change specify the layer/layer the tool has to access. for ed params.setLayers(new int[]{0,1,2,3});3. after accessing the layer you have to tell the tool on what bases or record it has to pull out. Usually it has to be a primary key like record_id or a object id so chanege the field name in the following code according to a primary key in your mapservice.in my case : if(curResult.getAttributes().containsKey("RECORDID")){ outputVal = curResult.getAttributes().get("RECORDID").toString(); With these three things done your code and tool should work fine.do reply as whether this worked.Regards,Nigel.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.