This document is archived and information here might be outdated. Recommended version. |
Create a raster that has direction in degrees from each cell center to the cell center of the closest source.
/// <summary> /// Create a raster that has direction in degrees from each cell center to the cell center of the closest source. /// </summary> /// <param name="geoDataset">An IGeoDataset interface that identifies those cells or locations whose values are assigned to the output cell locations that they are closest to.</param> /// <returns>An IGeoDataset interface that has direction in degrees from each cell center to the cell center of the closest source.</returns> /// <remarks> /// Note: the input geoDataset's must be of Type IRaster, IRasterDataset, IRasterBand, IRasterDescriptor or IFeatureClass. /// /// The IDistanceOp.EucDirection Method has two options (maxDistance and valueRaster) that /// will greatly vary the output raster. Thess values will need to be adjusted for your application to achieve /// the desired results. /// /// For information about the IDistanceOp.EucDirection Method see: /// http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriSpatialAnalyst/IDistanceOp_EucDirection.htm /// /// For more information on working with the ArcGIS Spatial Anaylst objects see: /// http://edndoc.esri.com/arcobjects/9.2/CPP_VB6_VBA_VCPP_Doc/COM/VB6/working/work_rasters/sptl_analyst_objs.htm /// </remarks> public ESRI.ArcGIS.Geodatabase.IGeoDataset CreateDistanceOpEucDirectionRaster(ESRI.ArcGIS.Geodatabase.IGeoDataset geoDataset) { if (geoDataset is ESRI.ArcGIS.Geodatabase.IRaster | geoDataset is ESRI.ArcGIS.Geodatabase.IRasterDataset | geoDataset is ESRI.ArcGIS.DataSourcesRaster.IRasterBand | geoDataset is ESRI.ArcGIS.GeoAnalyst.IRasterDescriptor | geoDataset is ESRI.ArcGIS.Geodatabase.IFeatureClass) { // Create the RasterDistanceOp object ESRI.ArcGIS.SpatialAnalyst.IDistanceOp distanceOp=new ESRI.ArcGIS.SpatialAnalyst.RasterDistanceOpClass(); // Declare the output raster object //Note: Adjust the IDistanceOp.EucDirection method options to suit your applications need. object object_missing1=System.Type.Missing; object object_missing2=System.Type.Missing; ESRI.ArcGIS.Geodatabase.IGeoDataset geoDataset_output=distanceOp.EucDirection(geoDataset, ref object_missing1, ref object_missing2); return geoDataset_output; } else { //Invalid type of GeoDataset for this process return null; } }
''' <summary> ''' Create a raster that has direction in degrees from each cell center to the cell center of the closest source. ''' </summary> ''' <param name="geoDataset">An IGeoDataset interface that identifies those cells or locations whose values are assigned to the output cell locations that they are closest to.</param> ''' <returns>An IGeoDataset interface that has direction in degrees from each cell center to the cell center of the closest source.</returns> ''' <remarks> ''' Note: the input geoDataset's must be of Type IRaster, IRasterDataset, IRasterBand, IRasterDescriptor or IFeatureClass. ''' ''' The IDistanceOp.EucDirection Method has two options (maxDistance and valueRaster) that ''' will greatly vary the output raster. Thess values will need to be adjusted for your application to achieve ''' the desired results. ''' ''' For information about the IDistanceOp.EucDirection Method see: ''' http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriSpatialAnalyst/IDistanceOp_EucDirection.htm ''' ''' For more information on working with the ArcGIS Spatial Anaylst objects see: ''' http://edndoc.esri.com/arcobjects/9.2/CPP_VB6_VBA_VCPP_Doc/COM/VB6/working/work_rasters/sptl_analyst_objs.htm ''' </remarks> Public Function CreateDistanceOpEucDirectionRaster(ByVal geoDataset As ESRI.ArcGIS.Geodatabase.IGeoDataset) As ESRI.ArcGIS.Geodatabase.IGeoDataset If (TypeOf geoDataset Is ESRI.ArcGIS.Geodatabase.IRaster _ Or TypeOf geoDataset Is ESRI.ArcGIS.Geodatabase.IRasterDataset _ Or TypeOf geoDataset Is ESRI.ArcGIS.DataSourcesRaster.IRasterBand _ Or TypeOf geoDataset Is ESRI.ArcGIS.GeoAnalyst.IRasterDescriptor _ Or TypeOf geoDataset Is ESRI.ArcGIS.Geodatabase.IFeatureClass) Then ' Create the RasterDistanceOp object Dim distanceOp As ESRI.ArcGIS.SpatialAnalyst.IDistanceOp=New ESRI.ArcGIS.SpatialAnalyst.RasterDistanceOpClass ' Declare the output raster object 'Note: Adjust the IDistanceOp.EucDirection method options to suit your applications need. Dim object_missing1 As System.Object=System.Type.Missing Dim object_missing2 As System.Object=System.Type.Missing Dim geoDataset_output As ESRI.ArcGIS.Geodatabase.IGeoDataset=distanceOp.EucDirection(geoDataset, object_missing1, object_missing2) Return geoDataset_output Else 'Invalid type of GeoDataset for this process Return Nothing End If End Function