show icon at the start and end points of the route

704
0
01-04-2012 03:59 PM
lelewin
New Contributor II
Hi,

Now I am trying to show icon/image at the start and end of the route but i can't manage to show them. please someone help me if you know how  to do it.

sample code

<script type="text/JavaScript">



var OneMap = new GetOneMap("divMain","SM")

      

       function getDirections() {

      

        var routeData = new Route;

  routeData.routeStops = document.getElementById('txtTheme').value;

        routeData.routeMode = document.getElementById('txtOtptFlds').value;

        routeData.avoidERP = document.getElementById('txtExtent').value;

        routeData.routeOption = "Shortest";

        routeData.GetRoute(showRouteData)

        }

           

        function showRouteData(routeResults)

        {

      if (routeResults.results=="No results"){

             alert("No Route found, please try other location.")

             return

             }

             else if (routeResults.results=="Stops more than nine"){

             alert("Number of stops exceed than nine");

          return;

         }

            directions = routeResults.results.directions[0];



            directionFeatures = directions.features;

               

            var routeSymbol = new esri.symbol.SimpleLineSymbol().setColor(new dojo.Color([0,0,255,0.5])).setWidth(4);



            var mergedGeometry = new esri.geometry.Polyline()



            mergedGeometry.addPath(routeResults.results.routes.features[0].geometry.paths[0])

            OneMap.map.graphics.clear();

            OneMap.map.graphics.add(new esri.Graphic(mergedGeometry, routeSymbol));      

            //Display the total time and distance of the route

            document.getElementById("results").innerHTML = "<br />   Total distance: " +  directions.summary.totalLength + "<br />   Total time: " + directions.summary.totalTime;



            //List the directions and create hyperlinks for each route segment

                for (var i=0;i<directions.features.length;i++)

                {

                var feature=directions.features

                  document.getElementById("results").innerHTML= document.getElementById("results").innerHTML + '<br><u>' + parseInt(parseInt(i)+1) + ". " + feature.attributes.text + " (" + feature.attributes.length + ", " + feature.attributes.time  + ")</u>" 

               

                }

        }

  

    </script>
0 Kudos
0 Replies