Select to view content in your preferred language

Polygon drawing issue ArcGIS IOS Map

3357
1
01-20-2015 01:29 PM
MuhammadHassan1
New Contributor

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!!

0 Kudos
1 Reply
ArtemisFili
Esri Contributor

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

0 Kudos