AnsweredAssumed Answered

Query on ArcGISDynamicMapServiceLayer

Question asked by gakuminkato on May 18, 2013
Latest reply on Mar 17, 2015 by akshayanpat
Hello,

I am trying to query a point data on ArcGISDynamicMapServiceLayer with a single tap.
However, FeatureSet "fs_view" does not seem to catch anything with "queryTask.execute(query)"...
And the program goes to the line of "catch"(Exception e).

I have checked the followings with debugging.
- "env_v" has 2D envelope
- "queryTask" and "query" have values in them
- ???e??? has values. Please see attached jpg file

For now, in order to make code simple, only one element of "resultGraphic" is dealt with.

I am very new to development of applications, so I may miss very simple and fundamental components in my code. Please excuse me.
I am very grateful if anybody helped me out. I do not know around me any android developers who are familiar with ArcGIS Android SDK...

Thank you in advance,
Gakumin


 public void setDefaultTapActions_popup(){   Map_view.setOnSingleTapListener(new OnSingleTapListener() {    private static final long serialVersionUID = 1L;    private Context context;        @Override    public void onSingleTap(float x_v, float y_v) {     Point point = Map_view.toMapPoint(x_v, y_v);          // Tolerance: 20 pixel     Envelope env_v = new Envelope(point,20*Map_view.getResolution(), 20*Map_view.getResolution());           //Set query task     QueryTask queryTask = new QueryTask("****/MapServer/0");          //Set Spatial Reference     SpatialReference sr;     sr = dmsl_v.getSpatialReference();          //Set query parameters     Query query = new Query();     query.setInSpatialReference(sr);     query.setOutSpatialReference(sr);     query.setGeometry(env_v);     //For now, max number of returned features is 10.     query.setMaxFeatures(10);     query.setOutFields(new String[] { "*" });          //Execute query task     try {      FeatureSet fs_view = queryTask.execute(query);      //Get an array of graphics of the query result FeatureSet      Graphic[] resultGraphic = fs_view.getGraphics();      View popupView = createPopupView(resultGraphic[0]);            callout.show(point, popupView);      } catch (Exception e) {      // TODO Auto-generated catch block      e.printStackTrace();     } 

Attachments

Outcomes