If we have multiple polygons and we want to calculate the minimum bounding rectangle, how can we do this?
In the native iOS it's done http://stackoverflow.com/questions/1303265/algorithm-for-determining-minimum-bounding-rectangle-for-collection-of-latitude
To get min bounding rectangle of a bunch of geometries, you should union them together using the geometry engine - 10.2.5: AGSGeometryEngine Union
You can then use the envelope of the resulting geometry
I haven't worked with the Runtime SDK for iOS, but I just had a look at the documentation and the 10.2.5: AGSPolygon Class Reference has a property envelope that returns a 10.2.5: AGSEnvelope Class Reference . I would have expected to find methods for the union of envelopes, but for some reason I only see methods for intersecting envelopes. Anyway, you can use the methods provided in the page you referenced, extracting the xmin, ymin, xmax, ymax properties of the AGSEnvelope.
Yes I have already tried that and I was able to get the min and max value but while plotting those values on the arcgis map.Map is throwing the below exception:
libc++abi.dylib: terminating with uncaught exception of type Esri_runtimecore::Common::Out_of_range_exception: Out of range
As mentioned before I have no experience with the Runtime SDK for iOS, but I would verify the spatial reference of the map, the envelope and polygons. I you are inserting projected coordinates (large values) and these are being interpreted as geographic coordinates, this may cause these type of problems. Or if for some reason a value is not set of the output bounding envelope, this could also be the cause. Have you verified the values?
Xander Bakker Thanks for your help.Yes i have debug the values and my code is correctly converting the coordinates into Arcgis coordinates.I guess my code is correctly getting the min and max coordinates but due to some reason code is throwing exception while using those values with Arcgis.
It worked thanks a ton.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.