ArcGIS API for Silverlight call GP Service Preparation---GP model build, publish, test

Source: Internet
Author: User
Tags silverlight

Original: ArcGIS API for Silverlight call GP Service Preparation---GP model build, publish, test

First,GP rainfall Contour modeling, release and testing

In the Water Conservancy, meteorology and other industries, in the WebGIS to achieve spatial analysis functions, such as drawing contours, contour lines, such as face, buffer, etc. are often encountered, after a period of study and research, consult ESRI documents, consult others, Finally can be said to be a preliminary realization of the contour function, here to record the detailed operation steps and picture description, on the one hand is the summary of the effort, on the other hand hope can also be used in this regard to other comrades, play a role.

The next article is about the Silverlight call GP service code implementation, address: http://blog.csdn.net/taomanman/article/details/7937879, of course, is only a preliminary implementation, about contour annotation and so on need to continue to improve , you are welcome to explore technology together.

Here's how to do the detailed steps in ArcMap :

1), open ArcMap, load a boundaries surface layer, here is just for demonstration purposes, just to facilitate the use of contour clipping later.

2), before the model is established first look at a GP file structure diagram, as follows:

Figure A

Here is a brief introduction:

a,<ToolShare> is a folder under a directory on the local disk, which holds all the folders, files, models, and map mxd documents used in the GP model.

b, theToolData folder holds the Schema file Geodatabase, and the geodatabase holds the input feature point set.

c, theScripts folder is stored in ArcGIS in the model used in the Python script,python script is ArcGIS the standard scripting language in.

d, theDoc folder is stored in the model's user manual and help documents and so on.

e,Scratch folder to store the Scratch file Geodatabase, if you have shp and other files can also be imported into the file geodatabase. Also the working space of the GP model is usually pointed to the Scratch folder.

3), in the disk directory, such as D:\ under a new folder, such as named Simplegpservice, and then copy the folder path D:\SimpleGPService, to Catalog directory in ArcMap Find folder Connections, right-click connect Folderand paste the copied directory, and make a file association, as shown in:

Figure II

Might

Next, right-click the directory and choose New Folder, named Contourservice, as

Figure Four

Continue to create a new 2 folder under the contourservice folder, which is the Scratch and ToolData directories, respectively, as

Figure Five

Then create a new file geodatabase under Scratch and ToolData , respectively, with the name Scratch and Schema, as shown in:

Figure Six

Following the instructions above, after Setup is complete, the file directory structure should look like the following:

Figure Seven

Right-click the Schemaand select Create a new feature class Feature class, as shown in:

Figure Eight

Here, named Rainpoint, the feature type selects point Features, as shown in:

Figure Nine

Then select "Next", where the coordinate system select "unknow", do not need to import the common coordinate system, as shown in:

Figure 10

Click "Next"

Figure 11

Click Next

Figure 12

Continue to click Next, add a new field,YL, field type Double, this is the rainfall value field, as required according to the naming rules can be customized, because the field defined here, later in GP Called when the name is consistent and needs to be noted, as shown in:

Figure 13

Click "Finish" to finish. Now the folder directory structure is as follows:

For the desired clipping layer, you can import into the Scratch file geodatabase, such as:

Figure 14

Because the generated contours are often a region, you need to crop them according to a range, where I import a shp file of a boundaries layer and name the Output Feature Class , which is Clipfeature, such as:

Figure 15

Click OK .

At this point in ArcMap , the following is roughly the case:

Figure 16

4), next Create tool, right- contourservice folder, create a new Toolbox

Figure 17

Named Customcontourservicetool, at this time the directory structure is as follows:

Figure 18

Right-select the "Customcontourservicetool" tool and create a new Model, as shown in

Figure 19

A modeling window opens, like this:

Figure 20

To modify the name of the model, right-click in the Model workspace and selectmodel property

Figure 21

In the Properties window that opens, re-name the model, and tick the relative storage path, as shown in:

Figure 22

5), formally start modeling, open toolboxes, select "Kriging", as shown in:

Figure 23

Drag the Kriging tool directly into the model workspace, such as:

Figure 24

Right-select Kriging, the middle rounded rectangle, to add parameters for the input point features, such as:

Figure 25

Add the following as follows:

Figure 26

Because the point feature is a parameter, the point is first set to a model parameter, such as:

Figure 27

When the Model Parameter is added, a P is added automatically, and the right button selects "Property".

Figure 28

Switch to the data Type section and select theFeature Set

Figure 29

The input features and symbols are then imported from the tooldata\schema\rainpoint in the GP file structure, such as

Figure 30

Figure 31

When you click OK, such as

Figure 32

At this point, you need to modify the workspace,Select "geoprocessing", "enviroments", such as:

Figure 33

Point Workspace to the Scratch folder in the GP directory we created earlier

Figure 34

When done, follow

Figure 35

Double-click the Kriging rectangle in the open model,

Figure 36

Modify the output's Raster path to %scratchworkspace%, as shown in the following modifications:

Figure 37

Next, we continue to add the model elements, this time we want to add the Contour Contour Tool

Figure 38

Drag the tool directly to the model work area

Figure 39

Click Connect in the Model toolbar to attach the Kriging output and the Contour tool

Figure 40

Right- Contour, create parameter variable Contour interval

Figure 41

Figure 42

Also create a model parameter Pfor the variable, and double-click the variable to enter a value such as

Figure 43

The model at this point is as follows:

Figure 44

The next thing to do is crop, find the clip tool in the Toolbox, drag and drop it into the model work area to

Figure 45

Also connects the output of the Contour to the Clip operation

Figure 46

Right-click clip, create clip Features variable

Figure 47

Double-click the added Clip Featuresand select the clipfeaturethat was previously imported into the Scratch directory, as

Figure 48

Next, modify the output path in the model, have previously modified the Kriging , and in a similar way, modify the Contour and Clip , as

Figure 49

Figure 50

Finally, add the output parameter P for the output feature set

Figure 51

Finally a simple contour model was created successfully, such as

Figure 52

6), model testing

Figure 53

Select the model in the Catalog , right-click "Debug" and see the following window

Figure 54

Add several feature points to the map by clicking Add Feature and entering a YL value to test

Figure 55

Click "OK" button to test the model

Figure 56

The contour line is out.

7), publish the GP service, and add Toolbox to test again

Figure 57

Figure 58

Figure 59

Figure 60

In this way, the GIS Server has a GP service called Customcontourservicetool . Click ArcToolbox Window in the toolbar in ArcMap

Figure 61

Right-click to add a new Toolbox

Figure 62

Figure 63

So the GP service we created and published was added to the toolbox, tested again, double-click the tool

Figure 64

Figure 65

Also add feature points on the map to test.

Figure 66

So far, the entire GP modeling and release and testing has been completed.

Note : the REST address of the GP service, right-click Services on the GIS Server , select service Properties

Figure 67

In the window that opens, copy the URL

Figure 68

Http://localhost/arcgis/services/CustomContourServiceTool/GPServer

URLslike this, and then add a restbetween ArcGIS and services , now in the form of a URL like this

Http://localhost/arcgis/rest/services/CustomContourServiceTool/GPServer

Open the browser, enter the above URL, you can access

Figure 69

Click Task to enter

Figure 70

The URL is the URL address of the GP , which will be used later in the development of the program.

The following information can be obtained from this URL :

URL:

Http://localhost/arcgis/rest/services/CustomContourServiceTool/GPServer/ContourServiceTool%20Model

Input parameters: Input_point_features and Contour_interval

Output parameter: contour_kriging1_clip_shp

===========================================================================

If you find it helpful, scan for support:



ArcGIS API for Silverlight call GP Service Preparation---GP model build, publish, test

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.