AnsweredAssumed Answered

Locate Button Will Not Find Location

Question asked by pburg_gis on Oct 30, 2013
Latest reply on Jul 28, 2014 by lsgaertner
I'm in the process of creating a web editing application by modifying some of the javascript examples.  I have added LocateButton into the app however when I click on the button it just spins.  It's not my browser because the examples work just fine.  Here is my code:

    <script>

      require([
        "dojo/ready", 
        "dojo/parser",
        "dijit/layout/BorderContainer",
        "dijit/layout/ContentPane", 
        "esri/map",
        "esri/dijit/LocateButton",
        "esri/config",
        "esri/tasks/GeometryService",
        "esri/urlUtils",
        "esri/arcgis/utils",
        "dojo/dom",
        "dojo/_base/array",
        "esri/dijit/editing/Editor",
        "dojo/domReady!"
        ], function(
          ready, 
          parser, 
          BorderContainer,
          ContentPane,
          Map,
          LocateButton,
          config,
          GeometryService,
          urlUtils,
          arcgisUtils,
          dom,
          array,
          Editor
        ) {

          ready(function(){
            parser.parse();
            config.defaults.io.proxyUrl = "/proxy";
            config.defaults.geometryService = new GeometryService("http://maps.ci.perrysburg.oh.us/arcgis/rest/services/Utilities/Geometry/GeometryServer");

            //check to see if a webmap was specified using URL params. If not use the 
            //hardcoded webmap id 
            var urlObject = urlUtils.urlToObject(document.location.href);
            var webmap = "90d7e213fb014d31ac623d233511fcf9";
            if(urlObject.query && urlObject.query.webmap){
              webmap = urlObject.query.webmap;
            }


            //create the map 
            arcgisUtils.createMap(webmap, "map", {
              mapOptions: {
                sliderStyle: "large"
              },
              ignorePopups: true
                             

            }).then(function(response){

              var map = response.map;
                dom.byId("title").innerHTML = response.itemInfo.item.title;
                dom.byId("snippet").innerHTML = response.itemInfo.item.snippet;
                
              geoLocate = new LocateButton({
               map: map,
               geolocationOptions: {
                      maximumAge: 0,
                      timeout: 15000,
                      enableHighAccuracy: true
                  }
              }, "LocateButton");               

                //create the editor widget 
                var layerInfo = [];

                var layers = response.itemInfo.itemData.operationalLayers;
                array.forEach(layers, function (layer){
                  layerInfo.push({
                    "featureLayer": layer.layerObject
                  });
                });

                var settings = {
                  map: map,
                  layerInfos: layerInfo
                };


                var editorWidget = new Editor({
                  settings: settings
                },"editorDiv");
                editorWidget.startup();



            });


        });
 
      });
    </script>


Any help would be much appreciated!

Thank you,
Ian

Outcomes