Coordinate + Scale widget for WAB Dev 2.2

3535
17
10-14-2016 09:58 AM
BarnabyRockwell
Occasional Contributor III

Back in February 2015, Tim Witt released a modified Coordinate widget that also shows current map scale.  I took the scale-related elements of that widget and added them to the Esri Coordinate widget released with WAB Developer Edition 2.2.

 

Here's a screenshot of the widget working in an app made using WAB Dev 2.2.  Note that this shot is from Firefox browser (it will appear this way in Chrome as well).  If IE11 is used, the scale will appear on same line as lat/long coordinates.

To install, unzip and place "Coordinate" folder in the widget folder of your WAB Dev 2.2 app after deleting the stock Esri Coordinate widget:

 

WABdev_2.2\server\apps\#\widgets

 

I strongly recommend that you DO NOT replace the stock Esri Coordinate widget in the base widget folder (\WABdev_2.2\client\stemapp\widgets), as doing so will greatly complicate general app handling (e.g. duplicating, creating) and the importing of apps from earlier versions of WAB Dev.

Let me know if any problems arise, and I will attempt to fix them.

EDIT:  This widget appears to also work for WAB Dev 2.3, 2.4, and 2.5.

17 Replies
JakubSisak
Occasional Contributor III

Awesome!  Thanks!

My defulat coordinate system is NAD 83 UTM 15 (metres).  The scale works great with that.  Displays exactly the scale levels i've set up with my cached services.  When I add a second coordinate system to this coordinate widget (WKID: 3857 TFWKKID: 1188 Units: DD) the scale works fine when the default coordinate system is shown. However when I switch to the WGS system, no coordinates are shown, only scale and the scale spans across 2 lines.  Switching back to default restores the coordinates and the scale.

Still, good enough for me for now. Great work! 

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus
AbrahamCoiman
New Contributor

Hello.

Coordinates don't  change when moving the mouse, they change when panning.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Abraham,

   That is by design when the maps WKID and the chosen WKID in the coordinate are not the same the widget will not update on a mouse move.

LefterisKoumis
Occasional Contributor III

Hello Robert. I have this strange behavior. I have an app where the map in config.json is set to          

"wkid": 102100

In the coordinates widget.js 

is set to :

 3857 : this.map.spatialReference.wkid;

The coordinate are shown when the mouse is moving.

In another app I have these identical settings but the coordinate is not updated when the mouse is moving.

Ideas?

Thanks.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Lefteris,

   You do not have the coordinate widgets mouse click button activated do you? When you click on the crosshairs button next to the coordinate readout you set the widget to click mode.

0 Kudos
LefterisKoumis
Occasional Contributor III

No. When the app starts the coordinate is not  updated when the mouse moves. I know about the click to activate the read the coordinate of the clicked location.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Strange. Can you attach your config_Cordinate.json file?

0 Kudos
LefterisKoumis
Occasional Contributor III

The json file of the widget is the same as the one you download. Haven't made any changes.

The config.json of the app is 

  "map": {
    "3D": false,
    "2D": true,
    "position": {
      "left": 0,
      "top": 85,
      "right": 0,
      "bottom": 0
    },
    "itemId": "8bf7167d20924cbf8e25e7b11c7c502c",
    "mapOptions": {
      "showLabels": true,
      "extent": {
        "xmin": -14260088.866018897,
        "ymin": 3333883.435196517,
        "xmax": -12107622.149508907,
        "ymax": 5310239.238537509,
        "spatialReference": {
          "wkid": 102100
        }
      }
    },
0 Kudos