Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have an problem with "Query Task" class of ESRI Sliverlight API 2.1 version.

I am saving a polygon with 2 exclusions [Inner rings] (i.e. say exlcusion 'A' as 4 vertices and exclusion 'B' with 5 vertices) into SDE database.When I do a Sliverlight ESRI query task to retrive the same shape, am getting exclusion B as first inner ring and exclusion A as second inner ring.How do I get a polygon rings (inner) in same order as I saved into database. I have tried Simplify method but still no luck.

Note: shapes from sliverlight has been saved to SDE using GP Tools where inner rings are added into geometry bag in same order and stored in geodatabase.

Let me know if any questions. Posted in ESRI forums no help as on today hence posting here.


Hi Petr and Krik: Thanks for your answers.

From Silverlight client am sending polygon as feature set to store in SDE using GP Tool. In the ArcObjects part of the code, we create the rings and add them to a IGeometry array. The outermost ring gets added first, followed by the inner rings(in the same order in which they were created). Finally IGeometryBridge.AddGeometries method was used to build a polygon from array of rings.

When we check the interior ring order after creation of the polygon geometry, it reflects the same order in which it was created in the Silverlight API. But once we store it in a SDE geodatabase featureclass, immediately the interior ring order gets modified.

I have asked same question in ESRI Forum. ESRI expert saying that order of rings will be changed for performance reasons while storing in SDE. Because of this when I query the same polygon using query task of Silverlight API, order of rings are changed.

If you look into Arcobjects, I can get order in same way using

SimplifyPreserveFromTo((ITopologicalOperator4)inputPoly).IsKnownSimple_2 = false;
inputPoly.SimplifyPreserveFromTo();

What is equivalent of SimplifyPreserveFromTo in ESRI Silverlight, or any best approach to get rings in same order.

Here important point - rings are not changed always, some times I am getting correct order while retriving from query task of Silverlight API.

Please help me on this further. Thanks in advance.

share|improve this question
    
Why do you want it to be in the same order? The order is irrelevant when you store a geometry. –  Devdatta Tengshe May 25 '12 at 13:39
    
Hi Devdatta, user will create a geometry (rings) in specific order and store in geodatabase, the same needs to be available throughout life cycle of the project. Hence require this. –  iamlaksh1 May 28 '12 at 7:10
    
Then store those rings as separate polygons; Not as a donut polygon. –  Devdatta Tengshe May 28 '12 at 14:57
    
@Devdatta: Thanks. We are using enterprise data model for the saving the polygon to SDE , I cannot change at this moment. Is there any other way?. Main requirement is sliverlight query task should return rings in same order. –  iamlaksh1 May 29 '12 at 5:56
    
You are looking at the wrong solution for your problem. Suppose you have stored a polygon in the shape of 'B' i.e. the outer boundary & the two inner holes; The order of the inner holes is not guaranteed to be in any specific order. If you need the order, you are definitely not going to get it from the polygon shape. The geometry is just NOT stored or processed in that way. –  Devdatta Tengshe May 29 '12 at 10:16

2 Answers 2

The order of rings really does not play any role in the stored geometry. As such, it is not guaranteed that it is preserved.

If your application relies on the order of rings which make up a polygon, you may need to rethink your model.

share|improve this answer
    
Kindly close this issue. Raised an incident with ESRI and they have taken this as an enhancement request. Thanks to Devdatta and Petr Krebs. –  iamlaksh1 Jun 7 '12 at 12:25

At 10.1 the REST API introduces support for M and Z values (but not ID's!) in polygons.

This means that you should be able to use IMSegmentation to encode M's into each Ring's points to reflect the ring's sequence within the polygon's IGeometrycollection, before saving your polygons to SDE.

The ArcGIS SDK for Silverlight 3.0 introduces support for M and Z values for polygons. This means that even though SDE changed the order of the rings, you can still find their original order by examining M values.

Update: Sorry, the only way I see to do this in versions earlier than 10.1 is to write an SOE or GP service that returns correctly ordered arrays of points (instead of polygons).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.