JavaScript API - Measuring Widget Issue

1759
2
Jump to solution
07-21-2016 12:55 PM
IanPeebles
Occasional Contributor III

I have tried to add in a measuring widget to my application and cannot get it to work, unless I add in a basemap property to the map.  There isn't much code.  Here is the error I am getting in console mode:

My application code is attached.  In the past, I used the same widget (at version 3.09 but did not have any issues).

Here is a brief snipped of the main application code:

// Define the default geometry service
esriConfig.defaults.geometryService = "http://gis.edmondok.com/arcgis/rest/services/Utilities/Geometry/GeometryServer";

        // Map - Initial Extent

        var initialExtent = new Extent(2097523, 220046, 2189056, 275030, new SpatialReference({wkid: 102724}));

     

        map = new Map("map", {

         extent: initialExtent,

        });

var measurement = new Measurement({

          map: map,

  defaultAreaUnit: Units.SQUARE_FEET,
  defaultLengthUnit: Units.FEET

        }, dom.byId("measurementDiv"));

        measurement.startup();

var baseMap = new ArcGISDynamicMapServiceLayer("http://gis.edmondok.com/arcgis/rest/services/Base/BaseMap/MapServer", {

           id: "Base Map",

           visible: true

        });

map.addLayers([baseMap]);

Any ideas on what could be the issue?  I am using the same geometry and services in other apps and they are working fine.

Thank you!  Ian

0 Kudos
1 Solution

Accepted Solutions
KellyHutchins
Esri Frequent Contributor

Try creating a new GeometryService and passing in your service url. For example:

esriConfig.defaults.geometryService = new GeometryService("http://gis.edmondok.com/arcgis/rest/services/Utilities/Geometry/GeometryServer");

View solution in original post

2 Replies
KellyHutchins
Esri Frequent Contributor

Try creating a new GeometryService and passing in your service url. For example:

esriConfig.defaults.geometryService = new GeometryService("http://gis.edmondok.com/arcgis/rest/services/Utilities/Geometry/GeometryServer");

IanPeebles
Occasional Contributor III

Kelly, that worked.  BTW, how can I get the units to display as I am drawing a line to get the length?  I only get the units when the draw is completed.

0 Kudos