Arcgis server geoprocessing
Posted:June 21st, 2010 |Author:Laomi |Filed under:Development log |Tags:Arcgis, internship, geoprocessing, rest | No Comments»
Previously, arcgis only solved some simple and small problems for the U.S. side. After all, there was no dedicated person to develop arcgis. Recently, our design was coming soon, start preparing to start system development. From the current development framework, I am mainly learning to use rest to develop functions in arcgis. There are two main reasons for choosing rest development: the first is the specific needs of the project; the second is that the rest development method of arcgis server has implemented the GIS development model that I dreamed of for many years. In fact, the most attractive part of arcgis is the geoprocessing part of arcgis server. If you choose to use this development mode, I believe that the amount of your code will be reduced to about 1/3, if you need to combine multiple functions of arcgis, this method is more suitable for you.
To learn about geoprocessing service in arcgis server, you should first understand the arctoolbox and ModelBuilder sections in arcgis desktop, because arctoolbox needs to be released to use geoprocessing service, when calling a service, you only need to call the corresponding service based on the parameters and service address. The materials you read when learning the materials are scattered. Only after seeing a training video of arcgis on youku can you gradually understand some of the meanings.
First, introduce modelbuilder, open an arcmap or catalog, and then open the arctoolbox to create a new arctoolbox, then, you can drag some functions in the arctoolbox in the relevant arcmap to the modelbuilder you created. In this way, the geoprocessing Service released has nothing to do with the specific map, in this way, the published service can be called by any application, but the input and output of data must meet your development mode. For detailed data support, refer to: input and output data types. Currently, we are used to the rest development mode, in addition, many tasks are to directly call the geoprocessing service in web applications.
There are two ways to publish the geoprocessing service. The first is to directly use arcgis server manager to publish the service. Generally, if you simply publish a geoprocessing service, create a new geopeocessing service directly in the new service. Another way to publish the geoprocessing service is to use the catalog method. Geopeocessing service actually has three types:
- A geoprocessing service
- A geoprocessing service with a source map document
- A geoprocessing service with a result map service
The three services can be roughly understood:
- A geoprocessing service, you can understand that in this situation, geoprocessing service is actually directly publishing the model as A service. It is A developed service and can be used by any application, according to the input and output data type of geoprocessing service, we can know that it has some restrictions on the data output data.
- A geoprocessing service with a source map document. In this mode, the service actually associates the model with the specific map data, so that the model can directly access the data in the source map document. (Model is a tool layer of the source map document)
- A geoprocessing service with a result map service, which has two types of services: map service and geoprocessing service, one of the biggest advantages of the Service in this situation is that the results can be saved and the results can be returned as dynamic layers. (Model is a tool layer of result map document)
For more information about the implementation of geoprocessing service, see Publishing geoprocessing services, in the future, I will release a geoprocessing service based on what I learned, how to Use the python language to easily expand geoprocessing functions, call geoprocessing serivce using javascript, and display results more beautifully.
(1)
Hello everyone! I am a GIS ideal! Today I will focus on the release of the GP (Geoprocessing) Service Based on ArcGIS Server9.3, this process mainly involves testing the model change In ArcMap and then releasing this service in arcgis server manager. Because this application is used in actual development, I will more detailed (consistent style ~)
Before explaining this, there was an episode. the exciting news was that ESRI was about to launch arcgis server 9.3.1. This version is an upgradeable version for server9.3 and is estimated to increase in the second quarter. for example, you can directly upgrade from version 9.3.No need to uninstallArcGIS 1, 9.3You can upgrade to ArcGIS 9.3.1.Enhanced javaSupportAccelerated map cache speed ....... For more information, see
Okay.Let's get down to the truth and continue to talk about the release of the GP service.
Data: mxd document (NewOrleansArea. mxd)
Tbx file (GP Models for ArcGIS Server. tbx)
For this model, you can refer to this figure for self-modeling (for example ):
(The purpose of this model is to add a point in the map document and then buffer the point layer on the map based on the configured radius. points falling within the buffer distance are displayed)
Step 1: Open ArcMap and open NewOrleansArea. mxd noticed that the Shelters layer is the layer for geographic processing. Open arctoolbox, right-click it, add a local model, browse it to GP Models for ArcGIS Server, and add it to arctoolbox. A new toolbox is displayed, showing a Clip Shelters. with Buffer right-click this and select Edit. The displayed page is displayed. Let's check the settings of this model.
Open the tools -- options -- Geoprocessing option to confirm the settings, as shown in the following figure:
After setting, right-click "input feature" in "model", select properties, and click the Data Type Tab. Note that the input parameter here is feature set by default. Click "OK" to exit.
Double-click the buffer. The buffer radius is set to 10 miles. You can also click OK to exit.
Right-click output buffers and check that the manager is selected.
Double-click the clip tool. Note that the input feature here is Shelters, that is, the element to be output exits in this layer by default.
Right-click nearby shelters, select Properties, click the layer symbol tab, pay attention to the path, and then exit cancel.
Step 2In arcmapTest this modelAnd saveDouble-click this model in arctoolbox to bring up a window. Click the small icon on the right. Then, you can set the distance and unit to buffer at the bottom. We use the default one and click it in the map display area on the right (for good observation, click the dot symbol) then, OK, and the model starts to process the process. After the process is completed, a layer will be added to the toc. This layer shows the position falling in the buffer distance. The default layer shown here is S_Clip.
After the test is complete, delete S_Clip. In arctoolbox, drag the model to the top of the toc display layer. Then we can directly save this document. In fact, the model here is equivalent to a tool layer. you can call this function only when you release the service in this map document.
Step 3Create a mapserviceAnd gpServiceIn this process, we open ArcGIS Server manager, click the service tag on the left, and click public a gis service on the right to browse the NewOrleansArea where the map document to be released is located. when mxd clicks next, please note that the following Geoprocessing Service is selected. This indicates that this map document contains a geographical processing tool.
Click "Next" and you will see two published services in your services list. One is the map service and the other is the geographical processing service. If an error message is displayed, verify your access permission settings and the location. processing tool layer added to MXD does not
(2)
Step 4: create a Web Application that can call this Geoprocessing Service
Click the Application tab on the left and then clickCreate Web Application
Enter the name and description to be created. Next, add a layer and navigate to NewOrleansArea. You can select an Interent-based access method here.
Click Next after adding a Task. In the displayed window, select Geoprocessing. Then, add an existing published geographic processing service for the Task. Then, click Supporting Services in in the pop-up window, browse the Geoprocessing Service released in the previous step and click OK.
Click the configuration below (configure ..) Set the running parameters of this service.
Note that you can set the following parameters for the above name and help tip. Here, I have modified a Help Tip and the remaining default values.
Note: If the Configuration window does not pop up or prompts that the configuration is incorrect, make sure to check your geographic processing service user permissions and whether they have been added to the map document.
Then, the operation is simple. You can directly complete the next step to display the final result:
Note: the processing service has been called. The display result is displayed in Results. There is a green dot in the map display area on the right. It is displayed inside three dots near the Green Dot. this Green Point enables you to click the dot layer within 10 kilometers of the Green Point. Please note that there is a Geopreccessing label on results and you can click it to bring up a window with a thorn icon and click it on the right. the map area is stabbed and then run to display the result in results.
The full text is complete!
Of course, it is mainly about service release. As long as the Service's geographic processing model has been built, it is mainly available for use in server development. Also, it is more convenient to call this service in Flex. applications have a promising future (to be discussed later )........ Finished receiving! So sleepy. I feel like I'm gone.
Make it clear that all Geoprocessing scripts must have output (Return Value )!
Reason: to use Geoprocessing scripts in ModelBuilder, output is required, because the basic principle of ModelBuilder is to connect the output of one Script. tool to the input of another Script. tool.
How to Set output (Return Value )?
Output = gp. SetParameterAsText (index, value)
There are two ways to publish a Geoprocessing service:
1. Publish a geoprocessing toolbox;
2. Publish an mxd map file containing the geoprocessing tool layer.
This section describes the process of creating a Geoprocessing service from a python Script. This Geoprocessing Service accepts two parameters (numbers) and returns the sum of the two parameters.
1. Create a toolbox: example 2 and add a Script to the example toolbox: