ArcGIS for iOS development series (6)-basics-layers-dynamic Layers

Source: Internet
Author: User

Next, we will continue to introduce layers in the previous section...

2 dynamic Layers

In contrast to static layers, the data obtained by the dynamic layer (agsdynamiclayer) is generated by the server in real time. In addition to basic information, the exportmapimage method and the exportdelegate delegate are also declared, dynamically retrieving map data from the corresponding map service is the base class of all dynamic service layers:


Figure 3-2-8 inheritance relationship of dynamic Layers

2.1 dynamic map service layer (agsdynamicmapservicelayer)

The dynamic map service layer (agsdynamicmapservicelayer) corresponds to the dynamic map service and is also the most basic service of arcgisserver. The URL structure is http: // <Server: port>/<instance>/rest/services/<service>/mapserver. The following is the layer initialization code:

Nsurl * url = [nsurl urlwithstring: @ "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/ specialty/esri_statecityhighway_usa/mapserver"]; nserror * error = nil; // Method for synchronously retrieving service information, it is not recommended to use it in the main thread. Agsmapserviceinfo * info = [agsmapserviceinfo mapserviceinfowithurl: urlerror: & error]; // confirm the service information and initialize the dynamic map service layer... agsdynamicmapservicelayer * layer = [warn: info];

2.2 image service layer (agsimageservicelayer)

The image service layer (agsimageservicelayer) corresponds to the image service and is the best choice for dynamic web access to image data. The URL structure is http: // <Server: port>/<instance>/rest/services/<service>/imageserver. The following is the layer initialization code:

Nsurl * url = [nsurl urlwithstring: @ "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer"]; agsimageservicelayer * layer = [Signature: url]; also provides attributes and methods that are unique to image data, such: compression ratio, band combination, mosaic rules, rendering rules, and grid interpolation are not described here. // Single-band grayscale map nsarray * grayscalebandids = [nsarrayarraywithobject: [nsnumber numberwithint: 0]; layer. bandids = grayscalebandids; // red, green, blue multi-band combination nsarray * rgbbandids = [Serial: [nsnumber numberwithint: 2], [nsnumber numberwithint: 5], [nsnumber numberwithint: 0], nil]; layer. bandids = rgbbandids;

2.3 WMS service layer (agswmslayer)

The WMS service layer (agswmslayer) corresponds to the OGC wms1.1 \ 1.1.1 \
1.3 standard network map service, WMS service is a restful style, so you can directly inherit agsdynamiclayer, URL structure: http: // <Server: port>/<instance>/services/<service>/mapserver/wmsserver. The following is the layer initialization code:

     NSURL* url = [NSURL URLWithString: @"http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StateCityHighway_USA/MapServer/WMSServer"];     AGSWMSLayer* wmsLayer = [[AGSWMSLayeralloc] initWithURL:url] autorelease];

2.4 graphic layer (agsgraphiclayer)

The graphic layer (agsgraphiclayer) is special and does not correspond to any service. It is completely created, updated, and destroyed by the client. It is a powerful tool for us to respond to user input and display query and analysis results. Common methods include addgraphic, removegraphic, and datachanged to update data. The following is the layer initialization code:

    AGSGraphicsLayer*myGraphicsLayer = [AGSGraphicsLayer graphicsLayer];

On the basis of this, the element service layer and sketch drawing layer are also derived, which are described in sequence below.

2.5 element service layer)

The element service layer (agsfeaturelayer) corresponds to the element service or dynamic map service. The element service features the ability to edit spatial data, including the geometric shape, attributes, and accessories of elements.

Figure 3-2-2-9 inheritance relationship of the element service layer

It can be understood from the functional design that agsfeaturelayer = agsquerytask + agsgraphiclayer, first from the dynamic service query elements, then fill the results into the graphic layer for display, URL structure:

Http: // <server: Port>/<instance>/rest/services/<service>/featureserver (mapserver)/<layerid>. The following is the layer initialization code:

     NSURL* url = [NSURL URLWithString: @"http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/0"];     AGSFeatureLayer* featureLayer =[AGSFeatureLayer featureServiceLayerWithURL: url mode:AGSFeatureLayerModeOnDemand];    

The mode parameter is an enumerated value: snapshot, on-demand, and selection. In the snapshot mode, all elements are obtained at one time, this mode is suitable for scenarios with a small number of elements. The on-demand mode dynamically acquires elements based on the current field of view. It is suitable for scenarios with a large number of elements and a high update frequency. The selection mode does not obtain any elements by default, dynamic acquisition based on query conditions.

Common Operations of agsfeaturelayer include: querydelegate, selectfeatureswithquery, and updatefeatures ).

* Detailed usage of agsfeaturelayer is described in "online editing.

2.6 sketch editing Layer)

The sketch editing layer encapsulates the geometric editing operations of elements based on the graphic layer, inheriting the professional editing mode of ArcGIS, including: element selection, node dragging, undo operations, restore operations, magnifiers, and so on.


Figure 3-2-2-10 sketch draw the inheritance relationship of the service layer

Main geometric objects for sketch Editing:

Table 3-2-1 main objects drawn from a sketch

· Node (vertex)

· Mid-point)

· Selected Vertex)

· Line)

· Surface filling (fill)

 

The general process is: Create a sketch editing layer-Get element graphics (agsgraphic object)-respond to the touch operation (click, long press)-Save the graphic editing result-update element graphics, the following is the layer initialization code:

        AGSSketchGraphicsLayer* sketchLyr =[[[AGSSketchGraphicsLayer alloc] initWithGeometry:nil]autorelease];        [self.mapViewaddMapLayer:sketchLyr withName:@"Sketch Layer"]; 

* Agssketchgraphiclayer does not need to be unknown. It can be used properly :). The detailed usage will be described in "online editing.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.