Author: flyingis
The first several articles in the ArcGIS Server development series set up a basic WebGIS development framework, including template application construction, attribute query, and query result highlighting. In ArcIMS, whether it is Java connector before 9.2 ,. net_link, htmlviewer, or the 9.2-in-house ADF functions can be easily implemented. In terms of software costs, ArcGIS Server Enterprise Edition is much higher than ArcIMS. How can we reflect the value of ArcGIS Server? We will start from this article to explore the value of ArcGIS Server and start from ArcGIS Server data sources ......
Objectives:
Buffer analysis for point elements
Preparations:
1. Understand valueobject and comojbect in ArcGIS Server.
2. Programming Method of buffer analysis in AO interface.
3. Review the four methods developed by ArcGIS Server in the first article.
4. Use vs2005 to create a template server application -- web mapping application and change the mapresourcemanager attribute.
Note that the map resource type used here is ArcGIS Server Internet. Add a new panel on the interface, which includes two textbox and one Comand, textbox corresponds to the X and Y coordinates of the buffer center. It takes the vertex as the center and a certain radius as the circular buffer.
Ideas:
Buffer analysis needs to be implemented in the AO interface. The input point should be a COM object, and the input XY coordinate point on the page is a soap API valueojbect. valueobject can be used in the ADF Web controls, but it cannot be used for the AO interface. Therefore, you need to convert valueobject to comojbect. after calling the buffer method of the itopologicaloperator interface, you will get the result of the buffer analysis, that is, a polygon. Likewise, this polygon is a comobject and needs to be reversed to valueobject to be displayed on the webpage.
Code implementation:
Create a new xybuffer class and implement the buffer function in its buffer method. First, set the rendering method of the input vertex in textbox as an ESRI. arcGIS. ADF. arcgisserver. pointn object. The rendering method is as follows: ESRI. arcGIS. ADF. arcgisserver. pointn Pt = new ESRI. arcGIS. ADF. arcgisserver. pointn ();
PT. x = X;
PT. Y = y;
// Set the vertex color
ESRI. ArcGIS. ADF. arcgisserver. rgbcolor RGB = new ESRI. ArcGIS. ADF. arcgisserver. rgbcolor ();
RGB. Red = 0;
RGB. Blue = 0;
RGB. Green = 20;
// Set the vertex symbol
ESRI. ArcGIS. ADF. arcgisserver. simplemarkersymbol SMS = new ESRI. ArcGIS. ADF. arcgisserver. simplemarkersymbol ();
SMS. Style = ESRI. ArcGIS. ADF. arcgisserver. esrisimplemarkerstyle. esrismscircle;
SMS. Color = RGB;
SMS. size = 20;
ESRI. ArcGIS. ADF. arcgisserver. markerelement marker = new ESRI. ArcGIS. ADF. arcgisserver. markerelement ();
Marker. symbol = SMS;
Marker. Point = pt;
Then we use ArcGIS Server local to establish a connection to datasource. This is very important, mainly to convert valueobject and comobject in this connection state. The user who establishes the connection should belong to the ArcGIS Server Management Group. ESRI. ArcGIS. ADF. Identity identity = new ESRI. ArcGIS. ADF. Identity ("user", "password", "localhost ");
ESRI. ArcGIS. ADF. Connection. AGS. agsserverconnection agsconnection;
Agsconnection = new ESRI. ArcGIS. ADF. Connection. AGS. agsserverconnection ("localhost", identity );
Agsconnection. Connect ();
ESRI. ArcGIS. server. iserverobjectmanager som = agsconnection. serverobjectmanager;
ESRI. ArcGIS. server. iservercontext servercontext = som. createservercontext ("Redlands", "mapserver ");
In this way, we can perform object conversion in the ArcGIS Server local connection mode: // define the point of the COM Object
ESRI. ArcGIS. Geometry. ipoint ipnt;
// Convert valueobject to comobject
Ipnt = (ESRI. ArcGIS. Geometry. ipoint) ESRI. ArcGIS. ADF. Web. CES. arcgisserver. converter. valueobjecttocomobject (PT, servercontext );
The following is the buffer analysis code in AO. I am familiar with AO programming and should be familiar with the following code: ESRI. arcGIS. geometry. itopologicaloperator topop = (ESRI. arcGIS. geometry. itopologicaloperator) ipnt;
Double bufferdistance = map. extent. width/6;
ESRI. ArcGIS. Geometry. ipolympus Gon bufferpolygon;
Bufferpolygon = (ESRI. ArcGIS. Geometry. ipolympus gon) topop. buffer (bufferdistance );
Bufferpolygon is the result of the buffer analysis, but it is not what we finally want, because ESRI. arcGIS. geometry. ipolympus Gon cannot be displayed in the ADF web control. You also need to perform a conversion: // define the valueobject vertex.
ESRI. ArcGIS. ADF. arcgisserver. polygonn buffer_polyn;
// Convert comobject to valueobject
Buffer_polyn = (ESRI. arcGIS. ADF. arcgisserver. polygonn) ESRI. arcGIS. ADF. web. datasources. arcgisserver. converter. comobjecttovalueobject (bufferpolygon, servercontext, typeof (ESRI. arcGIS. ADF. arcgisserver. polygonn ));
Buffer_polyn is the final result. It defines a rendering method: ESRI. ArcGIS. ADF. arcgisserver. rgbcolor rgb1 = new ESRI. ArcGIS. ADF. arcgisserver. rgbcolor ();
Rgb1.red= 200;
Rgb1.green= 200;
Rgb1.blue = 20;
// Set the fill color of the area
ESRI. ArcGIS. ADF. arcgisserver. simplefillsymbol sfs1 = new ESRI. ArcGIS. ADF. arcgisserver. simplefillsymbol ();
Sfs1.style = ESRI. ArcGIS. ADF. arcgisserver. esrisimplefillstyle. esrisfshorizontal;
Sfs1.color = rgb1;
ESRI. ArcGIS. ADF. arcgisserver. polygonelement polyelement1 = new ESRI. ArcGIS. ADF. arcgisserver. polygonelement ();
Polyelement1.symbol = sfs1;
Polyelement1.polygon = buffer_polyn;
Add marker and polyelement1 to ESRI. arcGIS. ADF. arcgisserver. in the graphicelement object array, refresh the customgraphics attribute passed to the current mapfunctionality and refresh the map control. The display style of the buffer zone is a series of horizontal parallel lines:
The buffer analysis function is implemented in ArcGIS Server. Although ArcIMS can also be implemented (the ArcIMS analysis function is also limited to this), there is a natural difference between the two. The former is based on AO, therefore, we can introduce all the analysis functions in AO to the server to implement more and more complex analysis functions.
Finally, what else do we need to consider?
1. ESRI. arcGIS. ADF. in the arcgisserver namespace, we use the pointn class, but we can also find the pointb class. For other geometric types, such as polylinen and polylineb, what is the difference between them?
2. throughout the development process, we used the data source specific API to rethink about the three ways and four ways of development mentioned in the first article.
3. In the example, we only show the buffer zone. If we need to use the buffer zone for further analysis, such as a 3-meter extension of a street to both sides, which houses or buildings need to be demolished or rebuilt? In this case, we need to perform further intersection analysis. We can also call the AO interface for implementation, and finally convert the result to valueobject for display, so that we can implement the decision analysis function module on the server. Of course, we can use this example for more in-depth extension.
4. How can I clear the displayed results?
It's early in the morning!