ArcGIS API for Silverlight Learning notes

Source: Internet
Author: User
Tags silverlight

Here is the main explanation to show the different service map first look at an example:

Create a new Silverlight project, in the MainPage.xaml file, introduce ESRI. Arcgis.client Namespaces and ESRI. The assembly in which the arcgis.client resides is ESRI.   Arcgis.client, and specify that the namespace name is Esri, and of course you can use your own aliases, such as Mygis. Then write the map control, and specify the mapping service in the maps, a simple service map is completed, the code is as follows:

<usercontrol x:class= "Arcgistiledlayer.mainpage"    xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/ Presentation "     xmlns:x=" Http://schemas.microsoft.com/winfx/2006/xaml "     xmlns:esri=" Clr-namespace:esri. Arcgis.client;assembly=esri. Arcgis.client ">    <grid x:name=" LayoutRoot ">        <esri:map x:name=" MyMap ">            <esri: Arcgistiledmapservicelayer id= "Mylayer"                 url= "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_ Streetmap_world_2d/mapserver "/>        </esri:Map>    </Grid></UserControl>

  

Explaining the meaning of the next code, after introducing the namespace, place a map control in the layout element Grid, and note that the map element must take the ESRI prefix (if you set the namespace name Mygis, the prefix must also be written as Mygis), and then place a layer in the map control. Strictly speaking, this is not called a layer, it should be called a map service "layer", each map service is a layer, a map control can host multiple service tiers, the map service each feature set is the actual layer, which is what we often call in ArcMap concept of the layer. We then specify the URL address of the service layer, which is a buffered online map service from ESRI, and of course you can use your own map service to directly use your own published services, and you will get an error saying that there is an "unsafe cross-domain" solution in our IIS root directory (typically c \ Inetpub\Wwwroot) placed two XML files (ClientAccessPolicy.xml and Crossdomain.xml), and the two files were added to ESRI's map service without cross-domain issues. Note that this two XML file is placed under the root directory of your map service, not the root of the Silverlight project you built.

When you press F5 to run, you can see a beautiful map, hold down SHIFT, draw a frame on the map to zoom in on the map, hold CTRL + Shift, draw a frame on the map to zoom out.

Of course we can also add other types of map services, such as the Arcgisdynamicmapservicelayer type, and we can also load multiple map services on a map control. The following code:

Code highlighting produced by Actipro Codehighlighter (freeware) http://www. Codehighlighter.com/--><usercontrol x:class= "Layerlist.mainpage"    xmlns= "http://schemas.microsoft.com/ Winfx/2006/xaml/presentation "     xmlns:x=" Http://schemas.microsoft.com/winfx/2006/xaml "     xmlns:esri=" Clr-namespace:esri. Arcgis.client;assembly=esri. Arcgis.client ">    <grid x:name=" LayoutRoot ">        <esri:Map>            <esri: Arcgistiledmapservicelayer url= "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_ShadedRelief_World_2D/ MapServer "/>            <esri:arcgisdynamicmapservicelayer url=" http://serverapps.esri.com/ArcGIS/rest/services/ California/mapserver "/>        </esri:Map></UserControl>

  

In Acrgis API for Silverlight (hereinafter referred to as AGSAPI4SL), depending on the data source, map service type, buffering, and so on, the map service is divided into different layers (as mentioned earlier, this layer differs from the concept of layers in arcmap). is the layer type Object model diagram provided in AGSAPI4SL.

Here's a brief description of each layer type:

1,layer is the base class for all layer types and is an abstract class.

2,graphicslayer is a map layer with a large number of interactive vector graphics, which, like the Graphicslayer concept in the ADF, Graphicslayer a collection of graphics, a graphics To set the map symbol (symbol) and geometry type (Geometry) of the vector graphic, the geometry type must match the map symbol. For example, a markersymbol type of point symbol, its corresponding geometry type must be MapPoint or multipoint,fillsymbol type of polygon symbol, its corresponding geometry type must be the Polygon,linesymbol type of line symbol, The corresponding geometry type must be Polyline)

3,featurelayer inherits from the Graphicslayer, this class can show us the rich feature graph, provides the perfect visual feeling to the user.

4,dynamiclayer inherits from Layer, is the base class of dynamic map service, is an abstract class.

5,Dynamicmapservicelayer inherits from Dynamiclayer, the base class of the dynamic map service that has not been cached, is an abstract class. This class can be inherited, allowing AGSAPI4SL to access non-cached dynamic map services such as the map service for Arcgisserver 9.3 and the OGC WMS service.

6,arcgisdynamicmapservicelayer inherits from Dynamicmapservicelayer, the dynamic map service published for the ArcGIS Server9.3 version, in the same vein, if you want to make Other dynamic map services, such as the OGC WMS service, also need to extend the above dynamicmapservicelayer like this layer.

7,arcgisimageservicelayer inherits from Dynamicmapservicelayer, ImageService released for the ArcGIS Server 9.3 release.

8,gpresultimagelayer inherits from Dynamicmapservicelayer, and results from the geoprocessing service. You can request a server-side GP service to dynamically generate a picture of the result and add the picture directly to the map control as a gpresultimagelayer layer.

9,elementlayer is the framework Element component layer, which allows us to add such button,textblock and even video to the map control.

10,tiledmapservicelayer is the base class for all map services that use caching, and is an abstract class. You can inherit this class so that AGSAPI4SL can access map services such as ArcGIS Server, map services for Google maps, map services for Virtual Earth, and so on, using cached map services.

11,arcgistiledmapservicelayer inherits from Tiledmapservicelayer, supports cached map services released by the Arcgisserver 9.3 version, and, similarly, If you want to use other cached map services in the client API, such as map services for Google maps, Virtual Earth's map services, and so on, you need to extend the above dynamicmapservicelayer as well as this layer.

12,bing.tilelayer inherits from Tilemapservicelayer, and supports the cached Bing maps SOAP Services map service released by Microsoft.

Through the above explanation, hoping to understand the types of AGSAPI4SL in the various layers of the inheritance relationship and its purpose, after understanding these basic concepts, the next work can be carried out smoothly, so-called AX, this chapter of the study, will certainly let you in the future development of the multiplier!

This explains here, next time continue!!!

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.