AnsweredAssumed Answered

reverse geocode doesnt update the box(Directions widget). Clicking to add a point also adds at coordinates instead of address

Question asked by sinharcgis on Oct 20, 2015
Latest reply on Oct 20, 2015 by sinharcgis

i used The Directions widget arcgis api javascript, but when i click on map,  reverse geocode doesnt update the box(Directions widget), Clicking to add a point also adds at coordinates instead of address. (I am using my own geocoding, geometry and routing services) .how to update address to box? thank you;

my code:

<!DOCTYPE html>

<html>

  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <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.14/dijit/themes/claro/claro.css">

    <link rel="stylesheet" href="http://js.arcgis.com/3.14/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 src="http://js.arcgis.com/3.14/"></script>

    <script>

      require([

        "esri/urlUtils", "esri/map", "esri/dijit/Search",  "esri/tasks/locator", "esri/dijit/Directions",

        "dojo/parser",

        "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"

      ], function(

        urlUtils, Map, Search,  Locator,  Directions,

        parser

      ) {

        parser.parse();

        //all requests to route.arcgis.com will proxy to the proxyUrl defined in this object.

        var strPathService = "http://115.79.20.1:6080/arcgis/rest/services/";

          map = new Map("map", {

              zoom: 6,

            

          });

          var tiled = new esri.layers.ArcGISDynamicMapServiceLayer(strPathService + "Bandochuyende/numberhouse/MapServer");

          map.addLayer(tiled);

 

 

        //travelModesServiceUrl option points to logistics service hosted from ArcGIS Online

        //by indicating this URL, a login prompt should not display

        var directions = new Directions({

          map: map,

           mapClickActive: true,

          searchOptions: {

             sources: [

               {

               locator: new Locator(strPathService + "Geocode/GEOCODING_SONHA_BH/GeocodeServer"),

   

                     name: "Custom Geocoding Service",

                     localSearchOptions: {

                     minScale: 3000000,

                       distance: 500000

                     },

                     placeholder: "Search Geocoder",

                     maxResults: 3,

                     maxSuggestions: 6,

                     enableSuggestions: false,

                     minCharacters: 0

                 }

                 ]

                 },

          //travelModesServiceUrl: "http://utility.arcgis.com/usrsvcs/servers/cdc3efd03ddd4721b99adce219629489/rest/services/World/Utilities/GPServer",

       routeTaskUrl: strPathService + "NetworkRouter/network01102015/NAServer/Route"

        },"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 id="map"

           data-dojo-type="dijit/layout/ContentPane"

           data-dojo-props="region:'center'">

      </div>

    </div>

  </body>

</html>

Outcomes