ArcGIS Server常見問題之二
同樣摘自ESRI公司網站。
| 內容摘要 | |||||
| 本指導描述了如何配置Windows XP SP2防火墻,使得ArcGIS Server能正常工作。為了完成下面 的過程,必須安裝Windows XP Service Pack 2,下面的步驟需要為ArcGIS Server配置Windows 防火墻。 |
|||||
| 過程描述 | |||||
| 當升級的Windows XP SP2,將安裝Windows防火墻。其缺省的設置使得Windows阻止所有從ArcGIS Server的連接。解決這個問題,需要在Windows防火墻設置中打開80端口,135端口,ArcSOM.exe 和ArcSOC.exe。 1、啟動Windows防火墻。開始 > 設置 > 控制面板 > Windows防火墻。缺省情況下,防火墻是啟 用的,這是推薦的設置。 2、點擊“例外”選項卡。 3、點擊“添加端口”。 4、添加下面的信息: 名稱:Web Port(http) 端口號:80 類型:TCP 點擊“確定”。 5、添加135端口,點擊“添加端口”。 6、添加下面的信息: 名稱:DCOM(ArcGIS Server) 端口號:135 類型:TCP 點擊“確定”。 7、點擊“添加程序”將ArcSOM.exe添加到例外。 8、點擊“瀏覽”,并瀏覽到: <ArcGIS Install Directory>\bin\ArcSOM.exe,例如 C:\Program Files\ArcGIS\bin\ArcSOM.exe 點擊“確定”。 9、點擊“添加程序”將ArcSOC.exe添加到例外。 10、點擊“瀏覽”,并瀏覽到: <ArcGIS Install Directory>\bin\ArcSOC.exe,例如 C:\Program Files\ArcGIS\bin\ArcSOC.exe 點擊“確定”。 11、這些端口和程序入口現在將顯示在程序和服務列表中。確保其之前的Check框被選中。 12、關閉Windows防火墻。 |
-------------------------------------------
| 內容摘要 | |||||
| 我們使用ArcGIS Server .net ADF來開發應用程序的時候,使用Map WebControl的話,一般都是通過設置控件的屬性來設定Host以及MapServerObject。那如何在程序運行過程中來動態的改變這些屬性,以使得地圖的內容發生相應的變化。下面是c#的代碼: | |||||
| 過程描述 | |||||
| 'Map1是地圖控件 Map1.Host = "ServerName"; Map1.ServerObject = "ServerObjectName"; WebMap webMap = Map1.CreateWebMap(); IMapServer mapServer = webMap.MapServer; IMapServerObjects mapServerObjects = mapServer as IMapServerObjects; mapServerObjects.RefreshServerObjects(); webMap.Refresh (); |
--------------------------------------------
| 內容摘要 | |||||
| 提供的指導描述了如何創建一個簡單的ArcGIS Server ASP.NET網頁。為了診斷,盡可能使用最小的應用,這樣有助于測試ArcGIS Server和.NET 應用開發框架(ADF)是否配置適當且工作正常。 | |||||
| 過程描述 | |||||
| 在運行這個例子前,在網絡服務器上必須安裝好.NET ADF,ArcGIS Server已經安裝并正常運行,達到所有的系統要求。 1.創建一個ASP.NET應用目錄。可以按照下面步驟創建: A. 在您的目錄<drive>:\inetpub\wwwroot下創建一個目錄。 B. 使用IIS管理器查看新建的目錄的屬性。 C. 在目錄標簽上,單擊創建按鈕,創建一個ASP.NET應用。 2.把下面的代碼復制到文本編輯器中,存為*.aspx文件。然后對它做如下編輯: A. 把esri:map標簽中的Host屬性改為運行著ArcGIS Server SOM(Server Object Manager)的機器。 B. 把ServerObject改為一個運行著的MapServer服務器對象。記住服務器對象的名稱區分大小寫。'World'和'world'不一樣。 <%@ Register TagPrefix="esri" Namespace="ESRI.ArcGIS.Server.WebControls" Assembly="ESRI.ArcGIS.Server.WebControls, Version=9.0.0.2, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" %> <html> <head> </head> <body> <form id="WebForm" method="post" runat="server"> <esri:map id="TheMap" UseMIMEData="True" Width="400px" Height="400px" style="LEFT: 200px; POSITION: relative; TOP: 30px" runat="server" BorderStyle="Solid" BorderColor="200,170,35" BorderWidth="10px" ServerObject="PoliticalEarthquakes" Host="tao" AutoFirstDraw="True"> </esri:map> </form> </body> </html> 3.在ASP.NET應用目錄下創建一個web.config文件。下面顯示了一個web.config文件的例子。 使用ArcGIS Server機器上的agsusers組中的帳戶配置這個文件。 把用戶名和密碼用明文寫在web.config文件中,可能不是存儲這個信息的安全方法。微軟提供了加密機制。這個例子只是用來診斷的。 <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <!-- Session state must be enabled for the map control --> <sessionState mode="InProc" /> <identity impersonate="true" userName="SomeDomain\SomeAcct" password="SomePassword" /> </system.web> </configuration> 4.在瀏覽器中輸入http://servername/virtualdirectory/myapp.aspx 來測試這個應用程序。 如果ArcGIS Server已經安裝,.NET ADF工作正常,那么將顯示一幅地圖。 5.完成測試后,刪除目錄中的文件,- 特別是包含明文密碼的web.config文件。 |
------------------------------------------
| 內容摘要 | |||||
| 雖然說ArcGIS Server的開發技術當中最重要的技術是ArcOBjects。但是和在C/S模式下使用的ArcObjects還是會有一些差別,一個很重要的區別就是不能使用New方法來創建ArcObjects。 | |||||
| 過程描述 | |||||
| 1 web應用調用的是遠程的Ao組件,這些Ao對象都運行在服務器ArcSoc.exe進程中,由服務器上下文(server context)統一來創建(IServerContext::CreateObject),并服務器上下文來統一的管理和操作,比如Ao對象之間的交互,釋放等。 2 ArcGIS Server是一個可分布式部署的軟件,GIS Server和Web應用可以部署在不同的機子上,而web應用的機子上只需要安裝ADF運行包,只有ArcObjects的代理,不安裝ArcObjects本身,因此web 應用沒有能力來創建本地的ArcObjects對象,這也是不能使用New方式來創建ArcObjects的原因。 |
-------------------------------------------
| 內容摘要 | |||||
| 使用ArcGIS Server開發的web應用程序,有時候會需要把分析結果以graphics的方式臨時添加到地圖上,但是graphics會遮蓋住下面的標注。設透明也無效。 | |||||
| 過程描述 | |||||
| 解決辦法: 打開ArcMap,把Serverobject中用到的地圖文檔(*.mxd)打開, 打開Labeling工具條,點擊label weight ranking工具, 在彈出的label weight ranking對話框上,把<default>的feature weight設為none, 停止并啟動Serverobject。 |
--------------------------------------------
| 內容摘要 | |||||
| 在設計階段,使用Impersonation控件的屬性頁面設置用戶、密碼、域或機器的Identity屬性的時候出錯。 | |||||
| 過程描述 | |||||
| 出錯原因是微軟的.Net框架認證在操作系統上沒有必要的權限。 處理方法: 1、打開控制面板 2、打開管理工具頁面 3、本地打開安全設置 4、打開本地策略 5、選擇用戶權利指派 6、選擇“以操作系統方式操作” 7、添加“agsadmin”和“agsusers”兩個組 8、確認本地策略設置復選框處于選定狀態 9、確定退出界面 10、重新啟動計算機 |
--------------------------------------
| 內容摘要 | |||||
| 下面的文章講的是怎么樣更新一個使用ESRI.net web controls和ArcGIS Server 9.0寫的web應用,使得它能支持Arcgis Server 9.1版本。 這里講的是ArcGIS Server 9.0的應用指的是在安裝了全部Service Packs的基礎上的。 |
|||||
| 過程描述 | |||||
| 使用下面的過程在9.1中來修改已有的9.0的web應用。 這些步驟對于僅僅把ArcGIS Server 9.0的應用運行在安裝了9.1的機器上時候是不必要的。 1 在Microsoft Visual Studio .NET中打開web應用。 2 在HTML 視圖中,用下面的語句替換已有的 @Register 語句。 <%@ Register TagPrefix="esri" Namespace="ESRI.ArcGIS.Server.WebControls" Assembly="ESRI.ArcGIS.Server.WebControls, Version=9.1.0.722, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" %> 注意:"Version="屬性值必須和上面語句中的一樣。 3 重新編譯并保存應用。 |
------------------------------------
| 內容摘要 | |||||
| 很多線劃圖數據進ArcSDE庫中都會有些對象轉換不進去。這些對象有很大一部分是由于數據本身有自相交的情況。如果這些線劃圖數據只是用來做底圖,而不需要做對象分析。則可以采用數據簡單化操作后再轉換入ArcSDE中。具體操作如下例子: | |||||
| 過程描述 | |||||
| Private Sub SimplifyPolyLine(pPolyline As esriGeometry.Polyline) '通過QI取得線對象的拓撲操作接口 Dim pTopologicalOperator As esriGeometry.ITopologicalOperator Set pTopologicalOperator = pPolyline '執行簡單化操作 pTopologicalOperator.Simplify '簡單化操作完了的數據可以轉換入ArcSDE中了 '下面代碼用來展示簡單化后的線數據的每個部分 Dim pGeometryCollection As esriGeometry.IGeometryCollection Set pGeometryCollection = pPolyline Dim i As Long For i = 0 To pGeometryCollection.GeometryCount - 1 Dim TempPolyline As esriGeometry.IGeometryCollection Dim TempPath As esriGeometry.IPath Set TempPolyline = New esriGeometry.Polyline Set TempPath = pGeometryCollection.Geometry(i) TempPolyline.AddGeometry TempPath MapControl1.FlashShape TempPolyline Set TempPath = Nothing Set TempPolyline = Nothing Next i End Sub 備注:點、線、面都可以執行簡單化操作。可以根據不同的業務需求來使用這些功能。 |
------------------------------------
| 內容摘要 | |||||
| 實現多個實體的聯合,通過這種聯合可以與其他幾何實體進行空間關系判斷,請看如下實例 | |||||
| 過程描述 | |||||
| '''''''''''''''''''''''''''''''''''''''''''''''' dim I as interger Dim SelectFeatureLineArr is Iarray Set SelectFeatureLineArr = new Array ‘加入實體到array中,之后 Dim pTmpGeom As IGeometry Dim pGeom As IGeometry Dim pOutputGeometry As IGeometry Dim pTopoOperator As ItopologicalOperator Dim lFeature As iFeature For i = 0 To SelectFeatureLineArr.Count - 1 Set lFeature = SelectFeatureLineArr.Element(i) Set pGeom = lFeature.ShapeCopy If i = 0 Then ' if its the first feature Set pTmpGeom = pGeom Set pOutputGeometry = pTmpGeom Else ' merge the geometry of the features Set pTopoOperator = pTmpGeom Set pOutputGeometry = pTopoOperator.Union(pGeom) Set pTmpGeom = pOutputGeometry End If Next i |
------------------------------------------------------------------------------------------------------------------
| 內容摘要 | |||||
| 提供了判斷幾何學之間空間關系的成員、方法。 其對如下產品有效: ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. |
|||||
| 過程描述 | |||||
| 描述 判斷兩個空間實體之間在幾何上是否有關聯并返回 bool變量,對于一些關聯的存在判斷有限制(要求輸入相同的尺寸)。 大部份的預先定義表示關系的操作員是互斥的。當使用時,關聯操作是用來決定兩個幾何空間實體之間存在的特定的關系。 Description Contains 包含指出是否這幾何實體包含另一個幾何實體 Crosses 交叉指出兩個實體是否交叉. Disjoint 脫節指出兩個實體在幾何上是不是沒有共同的點.,來判斷它們之間是否是橫斷關系 Equals 相等指出兩個實體是否相同并定義了相同的點 Overlaps 輸入的實體是否 重疊 Relation 兩實體之間是否有定義關聯存在. Touches 相觸與,指出兩實體之間是否有相觸與的關系. Within 判斷一個實體是否被另一個實體所包含 使用VB實例 Dim pRelOp As IrelationalOperator Dim oneFeature As iFeature Dim twoFeature As iFeature Set pRelOp = oneFeature.ShapeCopy If pRelOp.Touches(twoFeature.Shape) Then End if |
-----------------------------------------------------------------------------------------------------------------
| 內容摘要 | |||||
| 圖層渲染是GIS應用之中十分常用的功能,所有基于ArcOjects組件的ArcGIS軟件產品(如: ArcGIS Desktop, ArcGIS Engine, ArcGIS Server), 還有ArcIMS和MapObjects(Windows Edition & Java Edition)都提供了各種實用的渲染方法,詳細列舉如下: ArcOjects提供了SimpleRenderer, UniqueValueMapRenderer, ClassBreaksRenderer, DotDensityRenderer, ProportionalSymbolRenderer, ChartRenderer; ArcIMS提供了SimpleRenderer, SimpleLabelRenderer, ValueMapRenderer, ValueMapLableRenderer, ScaleDependentRenderer, GroupRenderer; MapObjects Windows Edition提供了ValueMapRenderer, ClassBreaksRenderer, DotDensityRenderer, LabelRenderer, EventRenderer, ZRenderer, GroupRenderer; MapObjects JavaEdition提供了SimpleRenderer, ValueMapRenderer, LabelRenderer, ScaleDependentRenderer, GroupRenderer; 跟一般的渲染功能有所不同,在ArcIMS和MapObjects的兩個版本中都提供的GroupRender它本身并不利用任何圖層的屬性來對圖層進行渲染,而是通過借用其他Renderer的功能,把它們組合起來,實現對同一個圖層進行不同類型的渲染效果的同時展現,比如對一個包含了人口總數量,男性人口數量和女性人口數量的世界地圖圖層(面狀)先利用人口總數量屬性現實分類渲染的效果,同時利用男性人口數量和女性人口數量屬性用直棒圖選然展現出兩個數值比較的效果。 可惜的是ArcObjects中偏偏沒有實現這種渲染功能。不過基于COM技術的ArcObjects所具有的可擴展性為我們自己去實現"GroupRenderer"提供了可能。 |
|||||
| 過程描述 | |||||
| ArcObjects中,圖層的渲染效果是通過實例化一個實現了某個渲染接口(ISimpleRenderer, IUniqueValueMapRenderer, IClassBreaksRenderer, IDotDensityRenderer, IProportionalSymbolRenderer, IChartRenderer之一)的CoClass類,然后作為該渲染接口類型的變量賦給圖層(IGeoFeatureLayer)的Renderer屬性來實現的。這個Renderer屬性是IFeatureRenderer接口類型,IFeatureRenderer中定義了一個叫做Draw的方法,其實ArcObjects中各種各樣的渲染效果就是通過這個Draw方法畫出來的,因為各個渲染效果CoClass都實現了IFeatureRenderer接口。所以要實現"GroupRenderer"效果,只要實現了IFeatureRenderer接口就可以了。以下提供VB和ArcGIS Server Java API的例程供大家參考: [VB6: CustomGroupRenderer.cls] Option Explicit Implements IFeatureRenderer Private m_Renderers As Collection Private Sub Class_Initialize() On Error GoTo ErrHand Set m_Renderers = New Collection GoTo EndProc ErrHand: MsgBox "Class Initialize" & Err.Description EndProc: Exit Sub End Sub Private Function IFeatureRenderer_CanRender(ByVal featClass As esriGeoDatabase.IFeatureClass, ByVal Display As esriDisplay.IDisplay) As Boolean On Error GoTo ErrHand If Not featClass.ShapeType = esriGeometryNull Then IFeatureRenderer_CanRender = True Else IFeatureRenderer_CanRender = False End If GoTo EndProc ErrHand: MsgBox "CanRender" & Err.Description EndProc: Exit Function End Function Private Sub IFeatureRenderer_Draw(ByVal Cursor As esriGeoDatabase.IFeatureCursor, _ ByVal drawPhase As esriSystem.esriDrawPhase, _ ByVal Display As esriDisplay.IDisplay, _ ByVal trackCancel As esriSystem.ITrackCancel) On Error GoTo ErrHand Dim i As Integer For i = 1 To m_Renderers.Count Dim r As IFeatureRenderer Set r = m_Renderers.Item(i) If (TypeOf r Is ISimpleRenderer) And (drawPhase = esriDPGeography) Then r.Draw Cursor, drawPhase, Display, trackCancel ElseIf (TypeOf r Is IUniqueValueRenderer) And (drawPhase = esriDPGeography) Then r.Draw Cursor, drawPhase, Display, trackCancel ElseIf (TypeOf r Is IClassBreaksRenderer) And (drawPhase = esriDPGeography) Then r.Draw Cursor, drawPhase, Display, trackCancel ElseIf (TypeOf r Is IDotDensityRenderer) And (drawPhase = esriDPGeography) Then r.Draw Cursor, drawPhase, Display, trackCancel ElseIf (TypeOf r Is IProportionalSymbolRenderer) And (drawPhase = esriDPAnnotation) Then r.Draw Cursor, drawPhase, Display, trackCancel ElseIf (TypeOf r Is IChartRenderer) And (drawPhase = esriDPAnnotation) Then r.Draw Cursor, drawPhase, Display, trackCancel End If Next i GoTo EndProc ErrHand: MsgBox "Draw" & Err.Description EndProc: Exit Sub End Sub Private Sub IFeatureRenderer_PrepareFilter(ByVal pFeatClass As esriGeoDatabase.IFeatureClass, ByVal QueryFilter As esriGeoDatabase.IQueryFilter) Dim i As Integer For i = 1 To m_Renderers.Count Dim r As IFeatureRenderer Set r = m_Renderers.Item(i) r.PrepareFilter pFeatClass, QueryFilter Next i End Sub Private Property Set IFeatureRenderer_ExclusionSet(ByVal pIDSet As esriCarto.IFeatureIDSet) End Property Private Property Get IFeatureRenderer_RenderPhase(ByVal drawPhase As esriSystem.esriDrawPhase) As Boolean On Error GoTo ErrHand IFeatureRenderer_RenderPhase = True Exit Property ErrHand: MsgBox "Get RenderPhase" & Err.Description End Property Private Property Get IFeatureRenderer_SymbolByFeature(ByVal Feature As esriGeoDatabase.IFeature) As esriDisplay.ISymbol On Error GoTo ErrHand Dim pSym As ISymbol Set pSym = m_LegendGroup.Class(0).Symbol Set IFeatureRenderer_SymbolByFeature = pSym GoTo EndProc ErrHand: MsgBox Err.Description EndProc: Set pSym = Nothing Exit Property End Property Public Sub AddRenderer(ByVal renderer As esriCarto.IFeatureRenderer) m_Renderers.Add renderer End Sub ========================================================================================================================================================== [ArcGIS Server Java API] //IGroupRenderer.java package com.esri.arcgis.samples.carto.renderers; import com.linar.jintegra.AutomationException; import java.io.IOException; import java.io.Serializable; public interface IGroupRenderer extends Serializable { public static final int IID27AC33C1_506B_41F6_B2F0_D6F163CB7699 = 1; public static final int xxDummy = 0; public static final String IID = "27AC33C1-506B-41F6-B2F0-D6F163CB7699"; public void addRenderer(Object iRenderer) throws IOException, AutomationException; } //CustomGroupRenderer.java package com.esri.arcgis.samples.carto.renderers; import java.io.IOException; import java.util.ArrayList; import com.esri.arcgis.server.*; import com.esri.arcgis.carto.*; import com.esri.arcgis.display.*; import com.esri.arcgis.geodatabase.*; import com.esri.arcgis.system.*; import com.esri.arcgis.geometry.esriGeometryType; import com.esri.arcgis.system.esriDrawPhase; import com.linar.jintegra.AutomationException; public class CustomGroupRenderer implements IFeatureRenderer, IGroupRenderer { private ILegendGroup pLegendGroup; private IServerContext serverContext; private ArrayList renderers = new ArrayList(); public CustomGroupRenderer(IServerContext sc) { try { serverContext = sc; pLegendGroup = new ILegendGroupProxy(serverContext.createObject(LegendGroup.getClsid())); ILegendClass pLegendClass = new ILegendClassProxy(sc.createObject(LegendClass.getClsid())); pLegendGroup.addClass(pLegendClass); pLegendGroup.setVisible(true); pLegendGroup.setEditable(true); } catch (AutomationException e) { System.out.println("AutomationException " + e); } catch (IOException e) { System.out.println("IOException " + e); } } public boolean canRender(IFeatureClass iFeatureClass, IDisplay iDisplay) throws IOException, AutomationException { if (iFeatureClass.getShapeType() == esriGeometryType.esriGeometryNull) { return true; } else { return false; } } public void prepareFilter(IFeatureClass iFeatureClass, IQueryFilter iQueryFilter) throws IOException, AutomationException { if (renderers.size() > 0) { for (int i = 0; i < renderers.size(); i++) { IFeatureRenderer pFR = new IFeatureRendererProxy(renderers.get(i)); pFR.prepareFilter(iFeatureClass, iQueryFilter); } } } public void draw(IFeatureCursor iFeatureCursor, int drawPhase, IDisplay iDisplay, ITrackCancel iTrackCancel) throws IOException, AutomationException { if (renderers.size() > 0) { for (int i = 0; i < renderers.size(); i++) { Object obj = renderers.get(i); if (obj instanceof ISimpleRenderer && drawPhase == esriDrawPhase.esriDPGeography) { IFeatureRenderer pFR = new IFeatureRendererProxy(obj); pFR.draw(iFeatureCursor, drawPhase, iDisplay, iTrackCancel); } if (obj instanceof IUniqueValueRenderer && drawPhase == esriDrawPhase.esriDPGeography) { IFeatureRenderer pFR = new IFeatureRendererProxy(obj); pFR.draw(iFeatureCursor, drawPhase, iDisplay, iTrackCancel); } if (obj instanceof IClassBreaksRenderer && drawPhase == esriDrawPhase.esriDPGeography) { IFeatureRenderer pFR = new IFeatureRendererProxy(obj); pFR.draw(iFeatureCursor, drawPhase, iDisplay, iTrackCancel); } if (obj instanceof IDotDensityRenderer && drawPhase == esriDrawPhase.esriDPGeography) { IFeatureRenderer pFR = new IFeatureRendererProxy(obj); pFR.draw(iFeatureCursor, drawPhase, iDisplay, iTrackCancel); } if (obj instanceof IProportionalSymbolRenderer && drawPhase == esriDrawPhase.esriDPAnnotation) { IFeatureRenderer pFR = new IFeatureRendererProxy(obj); pFR.draw(iFeatureCursor, drawPhase, iDisplay, iTrackCancel); } if (obj instanceof IChartRenderer && drawPhase == esriDrawPhase.esriDPAnnotation) { IFeatureRenderer pFR = new IFeatureRendererProxy(obj); pFR.draw(iFeatureCursor, drawPhase, iDisplay, iTrackCancel); } } } } public ISymbol getSymbolByFeature(IFeature iFeature) throws IOException, AutomationException { ISymbol pSym = pLegendGroup.esri_getClass(0).getSymbol(); return pSym; } public boolean isRenderPhase(int drawPhase) throws IOException, AutomationException { return true; } public void setExclusionSetByRef(IFeatureIDSet iFeatureIDSet) throws IOException, AutomationException { } public void addRenderer(Object iRenderer) throws IOException, AutomationException { renderers.add(iRenderer); } } 如果想要在TOC控件上動態的展現出渲染的效果,還需實現ILegendInfo接口,這里不做詳細說明。 |
浙公網安備 33010602011771號