My map is in Web Mercator projection but I want for my measurement values to be in UTM when the user does a measurement on the map with my measure tool. Is there any way to do this without having to go back to the server with every click of the mouse as a vertex is added?

geodesicLengths: function (polylines, lengthUnit) {

var radius = 6371.009 / 1.609344; // miles

var lengths = [];

dojo.forEach(polylines, function (polyline, idx) {

var length = 0;

dojo.forEach(polyline.paths, function (path, idx) {

var subLength = 0;

for (var i = 1; i < path.length; i++) {

var lon1 = path[i - 1][0] * Math.PI / 180;

var lon2 = path[i][0] * Math.PI / 180;

var lat1 = path[i - 1][1] * Math.PI / 180;

var lat2 = path[i][1] * Math.PI / 180;

var dLat = (lat2 - lat1);

var dLon = (lon2 - lon1);

var tempValue = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(dLon / 2) * Math.sin(dLon / 2);

var coefficient = 2 * Math.atan2(Math.sqrt(tempValue), Math.sqrt(1 - tempValue));

var distance = radius * coefficient;

subLength += distance;

}

length += subLength;

});

length *= esri.geometry.unitsDictionary[lengthUnit];

lengths.push(length);

});

return lengths;

},

geographicAreas: function (polygons, areaUnit) {

var radius = 6371009; //meters

var areas = [];

dojo.forEach(polygons, function (polygon, idx) {

var area = 0;

dojo.forEach(polygon.rings, function (ring, idx) {

var subArea = 0;

for (var i = 1; i < ring.length; i++) {

if (i < ring.length - 1) {

subArea += ((ring[i + 1][0] - ring[i - 1][0]) * Math.PI / 180) * Math.sin(ring[i][1] * Math.PI / 180);

}

else {

subArea += ((ring[1][0] - ring[i - 1][0]) * Math.PI / 180) * Math.sin(ring[i][1] * Math.PI / 180);

}

}

subArea *= radius * radius / 2 / 4046.87; //acres

area += subArea;

});

area *= esri.geometry.unitsDictionary[areaUnit];

areas.push(area);

});

return areas;

},

esri.geometry.unitsDictionary

what is that construct? I searched for it in the 9.3 and 10 js api documentation with no results and the only google reference to that term is in your post.

How can i achieve similar at the 9.3 level?

length *= esri.geometry.unitsDictionary[lengthUnit];

as:

length *= 1.609344; //because 1mile=1.609344 km, if you are looking for the result in the unit of kilometer

Just for your reference, here is the object:

unitsDictionary: {

//length unit conversion from miles

"esriMiles": 1,

"esriKilometers": 1.609344,

"esriFeet": 5280,

"esriMeters": 1609.34,

"esriYards": 1760,

"esriNauticalMiles": 0.869,

//area unit conversion from acres

"esriAcres": 1,

"esriSqKilometers": 0.004047,

"esriSqMiles": 0.0015625,

"esriSqFeet": 43560,

"esriSqMeters": 4046.87,

"esriHectares": 0.4047,

"esriSqYards": 4840

},

One other thing and i won't bother any longer. How can i calculate the perimeter of a polygon using the formulas you have provided?