Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have been working with ArcObjects Java for a short time and have not been able to find a solution to the following problems:

How to get the Raster object from a IRaster reference?

IRaster raster = rasterDataset.createDefaultRaster()

Raster rs = (Raster)raster

This gives classcastexception: com.esri.arcgis.geodatabase.IRasterProxy cannot be cast to com.esri.arcgis.datasourcesraster.Raster

I have been unable to find the documentation of IRasterProxy. Apparently it is deprecated!!

How to over write pixel values of an existing raster and store it permanently?

I am following this example but to no avail. I can see the pixel array is altered but when I open the raster in ArcMap I see no change.

How to get Raster Info?

RasterDataset streamOrderRas = (RasterDataset)streamOrderRaster

Raster raster = new Raster()

raster.appendBands(streamOrderRas)

IRasterInfo rasterInfo = raster.getRasterInfo()

I get AutomationException: No such interface supported, stacktrace shows it goes inside com.esri.arcgis.datasourcesraster.Raster.getRasterInfo()

Please forgive if the questions appear stupid. If some one can show some working examples of the above problems, i'd be very grateful.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Was able to solve the problems:

If you create a new raster dataset and write new pixels to it then you have to build the attribute table and compute statistics from the first pyramid level. Then it shows up properly in ArcMap.

Instead of getting the rasterInfo from the Raster object like I was doing, use the RasterDataset object.

Still have no idea about the casting problem.

Avishek

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.