problems solving a route in IE, but not in Firefox?

812
7
Jump to solution
11-20-2012 12:16 PM
TracySchloss
Frequent Contributor
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.
0 Kudos
1 Solution

Accepted Solutions
TracySchloss
Frequent Contributor
I found it!  I was using the find nearby mobile example.  The mobile components aren't fully supported in IE8, which is still our default browser.    When I studied my start location point closely, I saw that the Name attribute, which was supposed to get getting it's content for one of the mobile components, wasn't finding that value.

What looked like "undefined" name attribute value must have been something very strange internally.  So that point was not valid after all, causing one of my stops to be bad , which in turn caused the route to fail when trying to solve it!

IE 8 did NOT properly interpret
dojo.byID('loc').textContent
  I did not absolutely need to have a attribute of "name" on my point, so I just removed it. 
      var  startLoc = new esri.Graphic(esri.geometry.geographicToWebMercator(new esri.geometry.Point(currentLocation, new esri.SpatialReference({             wkid : 4326         }))), fromSymbol, {             source: pointSource,             RouteName : feature.attributes.FACILITY         });

View solution in original post

0 Kudos
7 Replies
JeffJacobson
Occasional Contributor III
The first thing I would do is run the JavaScript code through JSLint or JSHint to catch any errors.  Some errors will be ignored by one browser but not another.
0 Kudos
TracySchloss
Frequent Contributor
I've not used those before, but when I looked them up and check my code it was all basic formatting stuff.  Nothing that focuses in on this particular problem.
0 Kudos
TracySchloss
Frequent Contributor
Looking at the response from Fiddler, it says the stops parameters is invalid.  It gives me a place to start tomorrow anyway.
0 Kudos
TracySchloss
Frequent Contributor
I found it!  I was using the find nearby mobile example.  The mobile components aren't fully supported in IE8, which is still our default browser.    When I studied my start location point closely, I saw that the Name attribute, which was supposed to get getting it's content for one of the mobile components, wasn't finding that value.

What looked like "undefined" name attribute value must have been something very strange internally.  So that point was not valid after all, causing one of my stops to be bad , which in turn caused the route to fail when trying to solve it!

IE 8 did NOT properly interpret
dojo.byID('loc').textContent
  I did not absolutely need to have a attribute of "name" on my point, so I just removed it. 
      var  startLoc = new esri.Graphic(esri.geometry.geographicToWebMercator(new esri.geometry.Point(currentLocation, new esri.SpatialReference({             wkid : 4326         }))), fromSymbol, {             source: pointSource,             RouteName : feature.attributes.FACILITY         });
0 Kudos
__Rich_
Occasional Contributor III
schlot;251279 wrote:
IE 8 did NOT properly interpret
dojo.byID('loc').textContent

IE is interpreting that code correctly, the problem is that IE does not support the textContent property in its object model.
0 Kudos
TracySchloss
Frequent Contributor
The end result is the same no matter whether use the word "interpret" or  "support". Po-tay-to, po-tah-to as far as I'm concerned.  It doesn't work.  Do you know if it continues to be an issue with the newer version of IE?
0 Kudos
__Rich_
Occasional Contributor III
The end result is the same no matter whether use the word "interpret" or  "support". Po-tay-to, po-tah-to as far as I'm concerned.  It doesn't work.

With programming, in general, it does matter, details matter...otherwise you end up spending time barking up wrong trees etc.  Or just plain old "doing it wrong".  There's a difference between a bug and stated functionality.
Do you know if it continues to be an issue with the newer version of IE?

GIYF...but but it would appear that MS claim it does - http://msdn.microsoft.com/en-gb/library/ie/ff974773(v=vs.85).aspx

You could always try it for yourself, should take all of 30 seconds 🙂
0 Kudos