Select to view content in your preferred language

Geometry Service - Areas and Length

2937
3
07-11-2011 10:23 AM
RobertMEIER
Regular Contributor
I am trying to do this operation with the Silverlight API and was getting what I think is incorrect data, so I went and tried to do the same with the REST interface and am getting the same error.

I am using 102100 as my input SR, here is the ring I am using,
[
{
  "rings" : [
   [[-10538362.6559228,4720678.36533211],
   [-10536290.0466925,4720685.02967047],
   [-10536276.7180158,4718585.76308674],
   [-10538355.9915844,4718592.42742511],
   [-10538362.6559228,4720678.36533211]]
  ]
}
]

and the output is 9002, feet or 9035, miles. The ring was drawn in Silverlight and should be close to a square mile. The results are not close to a square mile.

9002:
Areas: 46759714.5770107
Lengths: 27352.8925285099

9035:
Areas: 1.67726725846316
Lengths: 5.1804617088494

Just as observation here, the lengths reported for a square mile should be close to 4, because it has 4 sides, this lengths value adds the last set of coordinates to the length, the last set is just the first coords, just used to close the polygon. Is this correct? If I create a Path like this using the same coords, not including the last one:
[
{
  "paths" : [
   [[-10538362.6559228,4720678.36533211],
   [-10536290.0466925,4720685.02967047],
   [-10536276.7180158,4718585.76308674],
   [-10538355.9915844,4718592.42742511]]
  ]
}
]
I get this value:

Lengths: 3.88431596189669

Close to 4, which is expected.

Am I doing something incorrectly? Any help is appreciated.

-bert
0 Kudos
3 Replies
DonnyVelazquez
Frequent Contributor
Did you ever find an answer to this? I'm having the same problem. The results just aren't making sense.
0 Kudos
nicogis
MVP Frequent Contributor
in 10.1 if you put last point = first point or you don't put last point = first point return result Ok (count n side).

In 10 rest seems not check if polygon is correct (first = last) or force it (Polygon: "...A polygon contains an array of rings and a spatialReference. Each ring is represented as an array of points. The first point of each ring is always the same as the last point ...") so result area is Ok while lenght use n-1 side.

In 10.1 however force it.

without:
http://servicesbeta2.esri.com/arcgis/rest/services/Geometry/GeometryServer/areasAndLengths?sr=102100...

with:
http://servicesbeta2.esri.com/arcgis/rest/services/Geometry/GeometryServer/areasAndLengths?sr=102100...
0 Kudos
DonnyVelazquez
Frequent Contributor
After going over a couple of other threads I found the problem. When your using Web Mercator its a good idea to use the "esri.geometry.geodesicDensify" before using "esri.geometry.geodesicAreas". If the map is using another type of projection then you should project your geometry to "World_Cylindrical_Equal_Area" using the geometry service and then use the geometry service's "areasAndLengths" function.

This will give you better accuracy.
0 Kudos