Has anyone had troubles solving a route on a routeTask between 2 points in IE where it worked fine in Firefox? I decided I needed a proxy set up because of the # of characters in my request meant I had exceeded the # or characters allowed. Then I thought my proxy set up itself was the problem and I didn't have it set up quite right. Now I am seeing my traffic going through the proxy, I'm still having no luck solving my route.I have defined my route parameters with two stops. They are in the same map projection. They are not the same point (It occurred to me to check!)My routeParams are defined as: routeParams = new esri.tasks.RouteParameters(); routeParams.stops = new esri.tasks.FeatureSet(); routeParams.returnRoutes = true; routeParams.returnDirections = true; routeParams.directionsLengthUnits = esri.Units.MILES; routeParams.outSpatialReference = map.spatialReference;
My routeTask is defined as routeTask = new esri.tasks.RouteTask("http://servicesbeta.esri.com/ArcGIS/rest/services/Network/USA/NAServer/Route");
My start location is a geocoded point, which I'm changing to webMercator. My end location is a feature returned earlier from a featureLayer.selectFeatures. routeParams.stops.features = []; //Add the starting location to the map var fromSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([105, 153, 0])); var startLoc = new esri.Graphic(esri.geometry.geographicToWebMercator(new esri.geometry.Point(currentLocation, new esri.SpatialReference({ wkid : 4326 }))), fromSymbol, { Name : dojo.byId('loc').textContent, source: pointSource, RouteName : feature.attributes.FACILITY }); resultLocationsLayer.add(startLoc); routeParams.stops.features.push(startLoc); // params.stops.features[0] = startLoc; //Add the ending location to the map var toSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([204, 0, 0])); var endLoc = new esri.Graphic(feature.geometry, toSymbol, { Name : feature.attributes.FACILITY, source: "selected by buffer", RouteName : feature.attributes.FACILITY }); resultLocationsLayer.add(endLoc); routeParams.stops.features.push(endLoc);
I can put a breakpoint in and see I have two stops defined as features. I thought maybe my function was trying to execute before the route was solved. So I changed to to listen for the event onSolveComplete. routeTask.solve(routeParams); // routeTask.solve(params, function(solveResult) { dojo.connect (routeTask, "onSolveComplete", showRoute); dojo.connect (routeTask, "onError", routeError);
This works just fine in Firefox. I get a map with two points and a highlighted line showing the route. In IE, it doesn't seem to properly solve my routeTask and just generates the error I set up for the onError event. My complete code attached. I would think I have points in 2 different coordinate systems are something, except for the fact it works just fine in Firefox.