Select to view content in your preferred language

3D Analyst - Interpolate Line / Profile Graph in ArcObjects

2090
2
10-11-2010 06:13 AM
BrentStevener
Deactivated User
I posted a thread originally in 3D Analyst forums, but I think it may better be served here.

I am looking at ways to programmatically run a couple of tools in 3D Analyst, 'Interpolate Line', and then 'Profile Graph' to show a graphical representation of the line at different elevation points. The resulting graph that is made when I run these two tools is great, but I need to do this behind the scenes using ArcObjects and be able to capture this graph output and save to the hard disk. However, I have found next to nothing on how to do something similar using ArcObjects (we are using version 10). Any ideas?
0 Kudos
2 Replies
RichardSullivan
Emerging Contributor
Ever figure this out?

I have a series of lines in a shapefile indicating where survey work was done, and I would like to get profiles of those lines from a DEM I have.  There has to be a faster and more accurate way of getting the profiles than by redrawing each line by hand.
0 Kudos
JosephSheffield
Deactivated User
I'm facing the same issue.  I've ended up writing my own code to extract the profile graphs from a raster.   I have a version working for Arc 9.3 and I am in the process of migrating this code over to Arc10.  However, I'm having an issue.  When trying to get the raster from a IRasterBand data type to the IRasterSurface I get a null return.

Here is the code so far:

public void GetThicknessData(IRasterLayer rAlamoSurface, IFeatureLayer fThicknessProfile)
          {
              try
              {
                  IFeature fProfile = fThicknessProfile.FeatureClass.GetFeature(11);
                  IPointCollection pPointCollection = null;
                  IPolyline pPolyLine = null;
                  IGeometry pGeom = null;
                  Double dCellSize = 30;
                  IRasterBandCollection pRasterBands = null;
                  pRasterBands = rAlamoSurface.Raster as IRasterBandCollection;
                  IRasterBand pRasterBand = pRasterBands.Item(0);
                  IRasterSurface pRasterSurface = null;
                  //I get the error here....trying to cast an IRasterBand to an IRasterSurface
                  //pRasterSurface.RasterBand = pRasterBand as IRasterSurface;
                  //I've found other VB.net references that use:
                  //pRasterSurface.RasterBand = pRasterBand;
                  //In every case I try the pRasterSurface is null.
                  pRasterSurface = rAlamoSurface.Raster as IRasterSurface;
0 Kudos