antrromet

The coordinates measure are out of bounds in Android route task issue

Discussion created by antrromet on Jan 23, 2013
I am a beginner in ArcGIS and I was following [HTML]http://resources.arcgis.com/en/help/android-sdk/concepts/index.html#//01190000003s000000[/HTML] tutorial. I am trying to find a route between two points. I created a sample application, in which first, i get the two points on map single tap as follows

@Override
        public boolean onSingleTap(final MotionEvent e)
        {
            Point point = map.toMapPoint(new Point(e.getX(), e.getY()));
            points.add(point);
            if (points.size() == 2)
            {
                new FindRouteTask().execute();
            }
            return true;
        }


and my FindRouteTask is as follows

private class FindRouteTask extends AsyncTask<Void, Void, RoutingResult>
    {

        ProgressDialog  dialog  = new ProgressDialog(FindeRouteActivity.this);
        RoutingResult   mResults;

        @Override
        protected void onPreExecute()
        {
            dialog.setMessage("Finding routes...");
            dialog.show();
        }

        @Override
        protected RoutingResult doInBackground(Void... params)
        {
            RoutingParameters routeParams = new RoutingParameters();
            routeParams.setImpedanceAttributeName("Length");

            String routeTaskURL = "http://tasks.arcgisonline.com/ArcGIS/rest/services/NetworkAnalysis/ESRI_Route_NA/NAServer/Route";
            RoutingTask routeTask = new RoutingTask(routeTaskURL, null);

            NAFeaturesAsFeature naFeatures = new NAFeaturesAsFeature();
            // Create the stop points from point geometry
            StopGraphic startPnt = new StopGraphic(points.get(0));
            StopGraphic endPnt = new StopGraphic(points.get(1));
            // set features on routing feature class
            naFeatures.setFeatures(new Graphic[] { startPnt, endPnt });
            // set stops on routing feature class
            routeParams.setStops(naFeatures);
            try
            {
                mResults = routeTask.solve(routeParams);
            } catch (Exception e)
            {
                e.printStackTrace();
                return null;
            }
            return mResults;
        }

        @Override
        protected void onPostExecute(RoutingResult result)
        {
            dialog.dismiss();
            points.clear();
            if (result == null || !result.getRoutes().isEmpty())
            {
                Toast.makeText(FindeRouteActivity.this, "There was some problem in fetching the routes. Please try again!", Toast.LENGTH_SHORT).show();
            } else
            {
                findRoute(result.getRoutes().get(0));
            }
        }

    }


But the problem is that routeTask.solve(routeParams) always throws a exception

Failed to convert the input propertyset into a recordset to load into the NAClass "Stops".  The coordinates or measures are out of bounds.

Could anyone please tell me what am I doing wrong and what the problem is??
-Thanks in advance

Outcomes