Irasterworkspaceex prasterwex = utilities. opensderasterwsex ();//Access rastercatalog in SDE
// Connect the rastercatalog in SDE
Public Static Irasterworkspaceex opensderasterwsex () {esrilicense (); // Licenseproduce. Engine this method is passed. // Licenseproduct. engiengeodb this method is abnormal Ipropertyset propertyset = New ESRI. ArcGIS. esrisystem. propertysetclass (); propertyset. setproperty ( " Server " , Configuration. sdeserver); propertyset. setproperty ( " Instance " , Configuration. sdeinstance); propertyset. setproperty ( " Database " , Configuration. sdedatabase); propertyset. setproperty ( " User " , Configuration. sdeuser); propertyset. setproperty ( " Password " , Configuration. sdepassword); propertyset. setproperty ( " Version " , Configuration. sdeversion); iworkspacefactory pwsfact = New Sdeworkspacefactory (); irasterworkspaceex PWS = Pwsfact. Open (propertyset, 0 ) As Irasterworkspaceex; Return PWS ;}
// Traverse all rasterdataset in rastercatalog
Irastercatalog rastercatalog = prasterwex. openrastercatalog (configuration. sderastercatalog ); // Traverse all rasterdataset under rastercatalog Itable table = rastercatalog As Itable; icursor cursor = Table. Search (Null , False ); Irow row = Cursor. nextrow (); List <Irasterdataset> li_rasters = New List <irasterdataset> (); // Traverse rastercatalog and add all rasterds While (Row! = Null ) {Irastercatalogitem rastercatalogitem = Row As Irastercatalogitem; irasterdataset rasterdataset = Rastercatalogitem. rasterdataset; li_rasters.add (rasterdataset); row = Cursor. nextrow ();}
// Rastercatalog:
To store a set of spaces, refer to the same rasterdataset. rastercatalog equivalent to featureclass + raster field and shape field. Each rasterdataset in rastercatalog is equivalent to a feature
Reference: rastercatalog... in the search
// Use featureclass to process rastercatalog
Irasterworkspaceex prasterwex = utilities. opensderasterwsex (); // Access rastercatalog in SDE Irastercatalog rastercatalog = prasterwex. openrastercatalog (configuration. sderastercatalog ); // Traverse all rasterdataset under rastercatalog Ipolympus Ppart = New Polylineclass (); // Line of the intersection Ifeatureclass PFC = Rastercatalog As Ifeatureclass; ifeaturecursor pfcc = PFC. Search ( Null , False ); Ifeature pf = Pfcc. nextfeature (); While (PF! = Null ){ Bool Partialintersect = False ; Irastercatalogitem rastercatalogitem = Pf As Irastercatalogitem; iraster praster = Rastercatalogitem. rasterdataset. createdefaultraster (); // String Rastername = PF. get_value (PF. Fields. findfield ( " Name " ). Tostring (); // Rasterdataset name If (Rastername = configuration. bottomraster) // If it is the bottommost Layer {Pf = Pfcc. nextfeature (); Continue ;}