iosmapkitarcgisesriesri-arc-engine

draw a line on ArcGIS map fro iOS


I am now moving to ArcGIS maps for one of my iOS project.

how do you draw a line between two points. in the case of MapKit you use MKPolyLine.

Thanks


Solution

  • There are several steps to this if you don't have any map layers defined yet. The classes you'll need are documented here. Your map view (AGSMapView) needs to have a graphics layer (AGSGraphicsLayer). You can add AGSGeometry objects to the graphics layer, such as a AGSSimpleLineGeomtry. You set the geometry of the AGSSimpleLineGeometry object from the AGSPolyline object which defines its geometry. Something like this:

    1. Use the AGSPolyline class to define the geometry (AGSPolyline is a subclass of AGSGeometry).

    2. Create an AGSGraphic object and set its geometry property to the polyline geometry created first. Use you can use one of the subclasses of AGSGraphic such as AGSSimpleLineGeometry.

    3. Add the AGSGraphic object to an AGSGraphicsLayer, which has been added to your map (AGSMapView is a UIView subclass)