Select to view content in your preferred language

geometry task, measure distance

872
1
05-14-2010 04:12 AM
LanceCrumbliss
Frequent Contributor
hi all,

my map is in WKID 102100.  the units of that spatial reference are meters, i believe.  my area of interest is the south central US.  when i measure using a Geometry Service, the returned meters seem to be off by quite a bit.  measuring a straight line from lafayette, la to baton rouge returns 101,000 meters.  it should be closer to about 87,000 meters.   i don't project to a new spatial reference before measuring since the distance units are already meters.  is there a different step i'm missing or am i doing something else wrong?

btw, i'm using the old fashioned Geometry service method of measuring because customizing the persistence behavior of the Action method of measuring isn't possible.

Private Sub MyDrawObject_DrawComplete(ByVal sender As Object, ByVal args As DrawEventArgs)

  Dim geometryService As New Tasks.GeometryService(_ServerName & "/ArcGIS/rest/services/Geometry/GeometryServer")
  Dim graphic As New Graphic

  Select Case _measuremode
   Case 2 'Polyline
    Dim polyline As ESRI.ArcGIS.Client.Geometry.Polyline = TryCast(args.Geometry, ESRI.ArcGIS.Client.Geometry.Polyline)
    polyline.SpatialReference = Map.SpatialReference '102100
    graphic.Symbol = DefaultLineSymbol
    graphic.Geometry = polyline
    AddHandler geometryService.LengthsCompleted, AddressOf GeometryService_LengthsCompleted
   Case 3 'Polygon
    Dim polygon As ESRI.ArcGIS.Client.Geometry.Polygon = TryCast(args.Geometry, ESRI.ArcGIS.Client.Geometry.Polygon)
    polygon.SpatialReference = Map.SpatialReference
    graphic.Symbol = DefaultFillSymbol
    graphic.Geometry = polygon
    AddHandler geometryService.AreasAndLengthsCompleted, AddressOf GeometryService_AreasAndLengthsCompleted
  End Select

  Dim graphicsLayer As GraphicsLayer = TryCast(Map.Layers("MeasureGraphicsLayer"), GraphicsLayer)
  graphicsLayer.Graphics.Add(graphic)

  Dim graphicList As New List(Of Graphic)()
  graphicList.Add(graphic)

  Select Case _measuremode
   Case 2 'Polyline
    geometryService.LengthsAsync(graphicList)
   Case 3 'Polygon
    geometryService.AreasAndLengthsAsync(graphicList)
  End Select
 End Sub

 Private Sub GeometryService_LengthsCompleted(ByVal sender As Object, ByVal args As ESRI.ArcGIS.Client.Tasks.LengthsEventArgs)
  _meters = args.Results(0)
  _kms = args.Results(0) * 0.001
  DisplayLinearResult()
 End Sub


lance
0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor
While the units in webmercator are indeed units, you must remember that projections add huge distortions to them. In other words, around Equator the scale distortion is about 1 (meaning correct scale), but as you get closer to the poles, the distortion moves towards infinity!
0 Kudos