Select to view content in your preferred language

Polygons from Draw class not working with Union

2196
1
Jump to solution
03-05-2012 09:35 AM
MichaelOberegger
Emerging Contributor
Hi everybody!

I have stumbled across a strange problem that I cannot explain, and any help would be appreciated.

I am trying to use a Geometry Service's union feature to unionize graphics that the user can draw. So far, I am able to get unions working with any combination of the following:
Extents (user draws an extent with the Draw class, but I convert it to a 5 point polygon)
Polygon (from Draw class, but ONLY when the user draws it clockwise)
Spatial Polygons (not sure if that is the correct term, but geometries returned from a query task)

However, if the user draws a circle with the draw tool, or draws a polygon counter clockwise, the union doesn't work. It will return a valid response, but there will be no ring for the circle or counter-clockwise polygon. So, for example, if I try to union a square and a circle, only a 5 point ring for the square will be in the union response. If I do two squares, or a square with a spatial polygon, all appropriate rings are returned in the union response.

My initial impression based on the draw polygon behavior was to do with the orientation of the points (clockwise vs counter-clockwise), but I imagine that the circle polygon returned by the draw tool would have a valid orientation... so I am not sure if this thought process is correct at all.

The only thing I am doing with the geometries that are returned from the drawtool or query task is creating a graphic and adding it to the map's graphic's layer. So no additional processing is being done.

My union code is based off of the sample provided at http://help.arcgis.com/EN/webapi/silverlight/samples/start.htm#Union . I haven't changed anything other than the source of the graphics.

Is there a property that needs to be specified in the graphic or geometry before sending it for a union? Is there a utility function somewhere that can correct the orientation of the polygon (if that is in fact the problem)?

Any help would be appreciated. I am absolutely stumped! Thank you in advance!

Mike
0 Kudos
1 Solution

Accepted Solutions
JenniferNery
Esri Regular Contributor
You can look at this SDK sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Simplify. After Draw completes, you will need to Simplify to make it topologically correct before you can send it to Union.

Alternatively, you can use Editor.Add (which will simplify after draw is complete) and Editor.Union: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsExplicitSave. This does not require much code from you, just create a button that points to an Editor with Map and GeometryServiceUrl set, you can then bind button command with Add or Union.

View solution in original post

0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
You can look at this SDK sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Simplify. After Draw completes, you will need to Simplify to make it topologically correct before you can send it to Union.

Alternatively, you can use Editor.Add (which will simplify after draw is complete) and Editor.Union: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsExplicitSave. This does not require much code from you, just create a button that points to an Editor with Map and GeometryServiceUrl set, you can then bind button command with Add or Union.
0 Kudos