what code do i need to create a direction map tool

2976
0
09-17-2013 02:04 PM
AlanaD_Andrea
New Contributor
I am trying to add a direction map tool widget to my asp.net mvc 4 application but each time i try to implement this code my map disapears and i get a few error messages in the console. can someone please help me figure out what i am missing and what code is really required to make this work with my already existing map. thank you in advance. here is my code and the errors i am getting:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title>Directions Widget</title>
    <link rel="stylesheet" href="http://js.arcgis.com/3.6/js/dojo/dijit/themes/claro/claro.css">
    <link rel="stylesheet" href="http://js.arcgis.com/3.6/js/esri/css/esri.css">
    <style>
      html, body, #map {
        height:100%;
        width:100%;
        margin:0;
        padding:0;
      }
      body {
        background-color:#FFF;
        overflow:hidden;
        font-family:"Trebuchet MS";
      }

    </style>

    <script>var dojoConfig = { parseOnLoad: true };</script>
    <script src="http://js.arcgis.com/3.6/"></script>
    <script>
      require(["esri/urlUtils", "esri/map", "esri/dijit/Directions", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"],
      function(urlUtils, Map, Directions){
        //all requests to route.arcgis.com will proxy to the proxyUrl defined in this object.
        urlUtils.addProxyRule({
          urlPrefix: "route.arcgis.com", 
          proxyUrl: "/sproxy"
        });

        var map = new Map("map", {
          basemap: "streets",
          center:[-98.56,39.82],
          zoom: 4
        });

        var directions = new Directions({
          map: map
        },"dir");

        directions.startup();
      });
    </script>
  </head>
  <body class="claro">
    <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline', gutters:false" style="width:100%;height:100%;">
      <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'right'" style="width:250px;">
        <div id="dir"></div>
      </div>
      <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'" id="map"></div>
   </div>
  </body>
</html>


errors:

Uncaught SyntaxError: Unexpected token < map.js:127
Uncaught ReferenceError: changeBasemap is not defined localhost:15885/Sentry/:186
Uncaught ReferenceError: map is not defined localhost:15885/Sentry/:111
Uncaught ReferenceError: addTypeSymbols is not defined utils.js:560
Uncaught ReferenceError: addTypeSymbols is not defined


here is the link to the documentation of the code i am using :
https://developers.arcgis.com/en/javascript/jssamples/widget_directions_basic.html


thank you.
Tags (2)
0 Kudos
0 Replies