julianok

Measurement widget 2.4 Location BUG

Discussion created by julianok on Aug 11, 2011
Latest reply on Aug 11, 2011 by Jian
I came across with something that I might be a bug in the location tool for the measurement widget.

I was looking for ways of customizing the Location coordinates to UTM so I had to use the workaround and change the inner html on the widget.
Using
location = dojo.query('[widgetid=\"result\"]')[0];

By doing this I was able to Add UTM coordinates right bellow the default Lat Long.

Then I happened to notice that the coordinates would not match.
After comparing and testing I found that the default Lat Long coordinates coming from the widget are wrong when either Lat Long is negative.

For example use decimal degree coordinates from a monument here in the university of Calgary:
Lon -114.131852814035 Lat 51.079891659168
The correct coordinates in degree minute second should be:
Lon: -114°7'55" Lat: 51°4'48"
Instead the Widget gives:
Lon: -115°52'5"  Lat: 51°4'48"
Longitude is almost 2 degrees off, while Latitude is OK.

I believe the problem might be with the Widget using Math.floor function when converting the coordinates to DMS. for example if you do Math.floor(-114.131852814035) = -115

Perhaps using the ABS would fix the problem.
            if (deg < 0) {
                signal = "-";
                deg = Math.abs(deg);
            }


The signal could be added to the integer degree afterwards.

I hope this help.

Outcomes