The first part of Silverlight's calling of the GP service: publishing the GP Service (geoprocessing Service)

Source: Internet
Author: User
Summary of Silverlight calling the GP Service

Let's talk about how to implement it. Here our goal is to learn to use ArcGIS Server to publish the GP service and access it on the client. Here we release a GP service that draws the contour, and a GP service that draws an equal plane (specifically, an interpolation grid image ). Let's take a look at the process below:

Here, I divide the process into two phases:

The first part is the process of setting up GIS services. The second part is to create a Silverlight application and call the GP service. The third part is about getting the GP service results.

 

Article 1: Build a GP Service

What I want to say before I start: The following is my summary of the GP service, because many people ask, so here is a small summary. Due to the rush of time, it is not very detailed. If you cannot understand it, you can leave a message, and you will be able to answer the question. If there is anything wrong, you may wish to point out that you can learn from each other and make progress together.

The following content of the GP service is officially started:

In the following steps,

1. Prepare the data and create a folder structure for the GP service. How to do this will be discussed later. 2. In moudelbuilder, establish the GP Model for contour drawing and the same-Face Model (interpolation model ). 3. for interpolation, because the result is a grid image, it cannot be directly obtained on the client. Here we also need to create a map document of the interpolation service, that is, we need to publish the GP service as the result map service. The process of publishing the GP service will also be discussed later. 4. After publishing the GP service, we 'd better test it to see if it is verified In ArcMap.

The above is a brief process of publishing the GP service, which is described in detail below:

 

1. Prepare data

Because we want to plot and interpolation the contour based on the input points. Therefore, we need to set the parameters of the input elements. For example, the points here represent the detection point of a certain pollutant, and there is a concentration attribute. We want to draw the contour line based on this concentration attribute, therefore, we need to define this attribute in the GP input parameter, that is, to define this concentration attribute in the input vertex element class.

Here we create a new element class pollutionpoints In ArcMap and add a concentration attribute: pollutionc. This element can not contain any vertex, but it only provides a template for the input parameters of the GP service.

First, we create a GP service folder and a geographical database to store our model data. Shows the structure:

 

Let's create the class to be input from the above polutionpoints, right-click the schema geographic data, and select "new" and "element class.

Click Next and select the coordinate system. Here we select the webmecator coordinate system (because the base map used in Silverlight is webmecator, we select this coordinate system, of course, you can choose another one based on your own needs ).

Next, click Next and go to the element field setting interface. Here we add a field: polutionc, which indicates the concentration value and the type is double precision.

After the field is set, click Finish. In this way, we can build the input to be input.

 

2. Create a model in modelbuilder. For more information about modeling, see: http://help.arcgis.com/zh-cn/arcgisdesktop/10.0/help/index.html#//002w00000001000000.

 

The following is a model for creating contour lines:

Note:

  1. Here we use the Spline Function Method for interpolation, because the spline function can produce a smooth curve.
  2. Element rotation is added here to remove non-closed line elements. Here we get the contour line in a circle.
  3. After the above smooth operation, we found that the effect is not very obvious. Of course, if you use another interpolation, such as the kerkin interpolation, it will still be effective.

Precautions for modeling:

A. Set the workspace of the environment and specify the current workspace as the previously created scratch folder. Click ArcMap-Environment

B. Set the output parameter location of each tool in the model and use the format % scratchworkspace % \ output file name. Note that the output results are element classes, and the output file name must be suffixed with. SHP, for example, contour. SHP.

C. set model parameters. It is important to note that not all parameter types can be used as input or output parameters of the GP service. The preceding model contains the p parameter description as model parameters. For details, refer:

Http://help.arcgis.com/zh-cn/arcgisdesktop/10.0/help/index.html#/na/002v00000004000000/

 

Here, I will use the pollutionpoints element class as the model parameter, but note that we need to change it to the element set in the input model parameter, because the input parameters of the GP service do not support element classes.

D. Set the value to be interpolated Based on the attribute value and draw the contour.

The model of the equal plane is relatively simple:

There is no modification here, and the final output is the grid image of a rectangle. If you want to get a non-rectangle (such as the same as the contour, that is, the elliptical shape, or the same as the map, further operations are required, you can use the mask tool to extract it. We will not demonstrate it here ).

After the model of the GP service is set, the modeling will come to an end. Next, let's talk about how to publish the GP service.

3. Publish the GP Service

After the model is created, we need to release our model, that is, the GP service. For the contour model, right-click the toolbox that we created to draw the contour and publish it directly. However, to draw the isosurface, We need to publish it as a result map service. The following describes how to publish the result map service:

I. Like the process of creating an isosurface model, you need to create an equal-face model, a folder structure, an environment workspace, and model parameters. Ii. Create a map document that will be published later. Iii. Run our isosurface model to draw Raster Data Images

Here we use a layer as the element source, or manually add it and enter the value of polutionc. Obtain the Raster Data image.

Note: The default raster images are displayed in different categories, and the images may not be easy to see, right-click the TOC to generate the new raster layer (that is, the result of running the model): rasterdata,

Click Properties and select the symbol system. Change the rendering style. Here we can select the stretch mode to achieve smooth gradient rendering:

 

After the model runs successfully, we need to manually drag the equivalent model to the TOC. At this time, the results generated during the previous model run are automatically generated, the grid generated by default is not very nice. We need to manually set its symbol system.

The Panel in TOC is shown as follows:

Note: You need to note the value of the layer. For example, if the value above is-0.115785 to 66.2464, the tool can only render the attribute values in this range. If the concentration attribute value of the element is greater than 66.2464, the rendering is based on the maximum color. If the value is smaller than-0.115785, the rendering is based on the minimum color.

After the preceding steps are successful, we can save the map document and then release the map document.

Right-click the saved map document and publish it to ArcGIS Server, as shown in:

Geoprocessing is selected by default, indicating that the map document contains a tool layer. Click Next to complete the release. Such a result map service is released.

Generally, after the above process is successful, my GIS service will not have any problems, but it may also be unable to use the GIS service due to the configuration of our respective computers, therefore, it is best to verify the success In ArcMap. The specific method is as follows:

Click our toolkit -- Right-click arctoolbox -- add toolbox, And Then browse to the GIS server, as shown in. After opening it, we will find the GP service we just released: a toolbox for creating contour lines, and a toolbox that draws an equal face.

Click Open to add it to our ArcMap toolbox. Then run the tool just like running our toolbox. If the correct result is obtained, it indicates that the GP service has been successfully published. If any problem exists, check according to the preceding instructions. I will not describe it here.

So far, the establishment of the GP service has been completed.

The next article describes how to use Silverlight to call the contour service and interpolation service.

(All Rights Reserved. For details, refer to the source)

 

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.