appliedoruser

Contours from XYZ Dataset [Java]

Discussion created by appliedoruser on Oct 3, 2011
I'm having a huge amount of trouble trying to create contour lines from an XY-Z dataset.  I have created a RasterDataset just fine and can display it on the map.  However, I have tried everything I could possibly find to make a contour, and have had no luck.

Here is my current code.
private RasterDataset rasterDataset;
 public void createContour2() throws UnknownHostException, IOException {
  RasterSurfaceOp surfaceOp = new RasterSurfaceOp();
  Point pnt = new Point();
  pnt.putCoords(100, 100);
  Multipoint inputPoints = new Multipoint();
  inputPoints.addPoint(pnt, null, null);

  Multipoint[] outputPoints = new Multipoint[50];
  Polyline[] contourLines = new Polyline[50];
  // IGeoDataset output = surfaceOp.slope(rasterDataset,
  // esriGeoAnalysisSlopeEnum.esriGeoAnalysisSlopeDegrees, null);
  // IRasterProps rasterProps = (IRasterProps) output;

  surfaceOp.contoursAsPolylines(rasterDataset, inputPoints, contourLines,
    outputPoints);
 }


The rasterDataset field was specified earlier.
I'm almost positive I've initialized all my inputs to contoursAsPolylines incorrectly but this is what made the most sense.

So (from my understanding) after this, there should be Polylines stored to contourLines but it errors out at the surfaceOp.contoursAsPolylines(...) method giving me an java.lang.ArrayStoreException. 

Am I going about this the right way? What is going on with my code?

Thanks!

Outcomes