Hi, I am new to ArcGIS IOS map. I need to know the Correct way of Drawing Polygon Object on ArcGIS Map
1) How to convert the Polygon points [Latitude & Longitudes] to Base Layer Special Reference ?
2) How to convert the Polygon points [Latitude & Longitudes] to ArcGIS map required "AGSPoint"?
It will be good if some one share working sample code for these points explanation, so that i can draw the polygon object on Map from Latitudes and longitudes.
Thanks!!
Hi Muhammad,
You first have to create a polygon geometry by using the latitude and longitude values.
The following document describes how to create every geometry object.
Geometry objects—ArcGIS Runtime SDK for iOS | ArcGIS for Developers
The code for the polygon is as follows
AGSMutablePolygon* poly = [[AGSMutablePolygon alloc] initWithSpatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326 WKT:nil]]; [poly addRingToPolygon]; [poly addPointToRing:[AGSPoint pointWithX:10 y:10 spatialReference:nil]]; [poly addPointToRing:[AGSPoint pointWithX:30 y:10 spatialReference:nil]]; [poly addPointToRing:[AGSPoint pointWithX:30 y:30 spatialReference:nil]]; [poly addPointToRing:[AGSPoint pointWithX:10 y:30 spatialReference:nil]]; [poly addPointToRing:[AGSPoint pointWithX:10 y:10 spatialReference:nil]];
Once you have created the geometry, the next step is to create a graphic that uses this geometry. Once you have a graphic, you can add it to the map's graphics layer.
The document below describes about creating a graphics layer and also has an example
Creating a Graphics layer—ArcGIS Runtime SDK for iOS | ArcGIS for Developers