Measurement  Location Customization

1004
6
02-13-2013 08:02 PM
nitakumari
New Contributor
Hello
Motive: Add esri.Meters unit to existing Location  units in esri.dijit.measurement dojo.

I am working on esri.dijit.measurement dojo in Arcgis server. In  this, the available units for Location
are "degrees and DMS". I want to add Meters unit in this. How can I do that. I am getting stuck in
this from yesterday. Anybody Please help me out, its very urgent.
Thanks in advance
0 Kudos
6 Replies
JianHuang
Occasional Contributor III
Not so sure how you can use meters to represent location. It means it offsets from an origin point?
0 Kudos
nitakumari
New Contributor
Not so sure how you can use meters to represent location. It means it offsets from an origin point?


Thanks Jian for your quick reply
Actually when I click a point on the map, I can get location in terms of degrees and degreeminutesseconds notation but I want to get the location in terms of x,y coordinates in meters like X : 769999.677, Y : 2682267.451.
I am also attaching the snapshot measurement.png. In this the default units present are shown. I want to include meters in this dropdown list.
Again thanks in advance .
0 Kudos
nitakumari
New Contributor
Hello Jian,
Here it is showing you are online now, If you have seen my reply, Please answer. If you have any doubt regarding the measurement post, Please ask me. I will reply quickly. I am also online.
Thanks
0 Kudos
JianHuang
Occasional Contributor III
Nita,

When we say a location is Longitude: -85.74, Latitude: 38.25, which means it's a point offset from Longitude: 0, Latitude: 0 on a sphere/ellipsoid (earth) surface under geographic coordinate system. If you want to use meters as unit, that means you want to represent the location in a 2D projected coordiante system from an origin point. Without projection information, it doesn't have a meaningful location x, y values.
What I'm trying to say is you would like to show a meaningful location here.
Back to your question, you can use the following code snippet to show the x, y values under current projection of your map.

dojo.connect(measurement, "onMeasureEnd", function(toolName, geometry){
  if (toolName === "location") {
    measurement.resultValue.domNode.innerHTML = "x: "+ geometry.x + "<br/>y: " + geometry.y;
  }
});
0 Kudos
nitakumari
New Contributor
Nita,

When we say a location is Longitude: -85.74, Latitude: 38.25, which means it's a point offset from Longitude: 0, Latitude: 0 on a sphere/ellipsoid (earth) surface under geographic coordinate system. If you want to use meters as unit, that means you want to represent the location in a 2D projected coordiante system from an origin point. Without projection information, it doesn't have a meaningful location x, y values.
What I'm trying to say is you would like to show a meaningful location here.
Back to your question, you can use the following code snippet to show the x, y values under current projection of your map.

dojo.connect(measurement, "onMeasureEnd", function(toolName, geometry){
  if (toolName === "location") {
    measurement.resultValue.domNode.innerHTML = "x: "+ geometry.x + "<br/>y: " + geometry.y;
  }
});



Hello Jian,

Thanks for your reply.
I have tested this code but its not working. I need to add esri.Meters in esri.dijit.measurement Location units. After adding this, I want to show measurement location by default in esri.Meters like below code

measurement = new esri.dijit.Measurement({ map: map, lineSymbol: sls,defaultLengthUnit: esri.Units.METERS, defaultAreaUnit: esri.Units.SQUARE_METERS; defaultLengthUnit: esri.Units.METERS}, dojo.byId('measurementDiv'));

but I am not having "esri.Units.METERS" in dropdownlist of units for location. So, I can I do that.

Thanks in advance
Nita
0 Kudos
AdrianMarsden
Occasional Contributor III
To add to this.  Esri tend to take a world view of things, alas.

To many, such as us in the UK, we take a local view.  ALL our data is in WKID 27700 - British National Grid - which is a simpla(ish) XY system, in METRES (note spelling) from a point in the Atlantic. 

The only co-ordinate system most of our users will ever come across  will be this.  They need to be able to give co-ordinates out in metres and be able to get them in.

Using Long Lats, or any other world projection just confuses the issue and I have to do conversions (in ArcIMS days 100+ lines of code, in AGS days, about 5)

So please can the Measurement Widget be set to use the co-ordinate system of the map and return in the units it uses.

Cheers

ACM
0 Kudos