ThinkGeo.com    |     Documentation    |     Premium Support

PolygonShape.Union(Collection<AreaBaseShape> uses 100% CPU

Greetings,


I am dissolving a shapefile using the method you have described on the code site.  When I call MultipolygonShape.Union(Collection<AreaBaseShape> it is very slow (which is understandable due to the large number of Polygons in the collection.  However, my biggest issue is that during this process (which can take 30 seconds to a minute) the CPU is pegged at 100%.  Is there any other method I can use to combine all the Polygons into one, or is there anything that can be done to make the method call more efficient?


Thanks,


.Ryan.



Ryan, 
  
 sorry I am typing this from my phone so I will try and make it brief and to the point.  The union is fairly effecient and taking 100% CPU means it is crunching the numbers.  We use a third party topology suite which is pretty standard so I can’t see much we can do to make it faster.  If the real problem is that why it is at 100% the app is locked on suggestion would be to put it on a background thread set at low priority and when it is done get an event back.  This way you can tell you users it is working but the ui is still responsive.  This also allows the user the ability to cancel it as you can always stop or abort the thread.  If you are not comfortable with threading we could whip you up a asymcrnous sample to show you. 
  
 By the way I am so glad you found the code on the code community.  We are working hard to add a bunch of cool samples to show what is possible with Map Suite.  Let me know if the idea above works for you.  If not just tell me a little more about your concerns,  maybe I am missing something. 
  
 David