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 two rasters Ras1 and Ras2.

I want to change the Ras1.

In Ras1, there are few areas, lines, points I am interested having nodata cells and wrong data cells.(limited to interested areas only not talking about the entire Ras1 image)

For those interested areas of Ras1 having nodata cells and wrong data cells, I want to replace cell values with Ras2.

I have seen few tools replace values, but those are value specific ( ie. Replacing all "10" value cells with "56" in entire image) and conditon tools in arcgis, deals with null/no data values.

Is there any way, I can do Replacing Raster Values in Ras1 with Ras2 of my chosen area in the image?? Is there any way I can use arcgis / envi / erdas for this? Please guide me.

share|improve this question
    
Usually these tools are not value-specific. E.g., when you replace the "10" value cells, you are replacing all those that meet a particular logical condition (namely, equal to 10); you can replace that logical condition by any grid of logical values (such as a mask grid for the "few areas" where you want to make changes). When you replace them with "56", you need to understand that as a grid of values (all equal to 56); in its place you can use any replacement grid (such as [Ras2]). –  whuber Feb 14 '12 at 16:42

2 Answers 2

up vote 5 down vote accepted

Do you have access to spatial analyst? If so, the Con function will do exactly what you want. Create a "condition" raster that is 1 where you want the values changed to Ras2 and 0 everywhere else. Execute the statements:

Ras1 = Con(Raster("condition"), Raster("Ras2"), Raster("Ras1"))
Ras1.save("Ras1")

This will replace Ras1 with your new raster. If you just want to create a new raster, change the string in the save function. If you do not have access to spatial analyst, I will see if there is a way around using the Con function.

ArcGIS 9.3.1 Raster Calculator method:

Again, assuming you have a condition raster as above.

outraster = con(condition > 0, Ras2, Ras1)

In the raster calculator, you just use the direct references rather than using the Raster function as I did for arcpy. You would then need to save your outraster and replace Ras1 with it.

share|improve this answer
    
I tried this, the resultant raster is having values '1" and "0" as it is calculating if condition true=1 and condition false=0. my Resultant raster should contain all cell values of Ras1 except the cells replaced with Ras2. In other words, all Ras1 values except the mask(Ras2) replaced with Ras2 cells..., I tried the other option combine also, but cell values are changing every whee in Ras1. Pls guide me. –  Dr. A.D.Prasad Feb 15 '12 at 2:18
1  
You tried exactly that command, using arcpy? I have used this function many times without the behavior you are describing. –  blord-castillo Feb 15 '12 at 5:01
    
I am sorry to say that, I am having arcgis 9.3. I tried your command in raster calculator of spatial analyst in arcgis9.3. I think arcpy is for version 10. I am very much thankful for your suggestions and guidance. With my limited resources like arcgis9.3/erdas2011/envi4.8/surfer10, can i manage in another way? –  Dr. A.D.Prasad Feb 15 '12 at 13:42
    
other wise is there any way I can keep field values of a shapefile in the Ras1? (actually i converted the shapefile field value to raster and calling as Ras2) –  Dr. A.D.Prasad Feb 15 '12 at 14:03

Maybe the function Merge will help you (I know it´s a little late haha). See the last part of the next link: http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=How%20Merge%20works

I have a similar problem, and this tool is supposed to solve it... the thing is that the "ordering" it´s not working properly with my rasters... let me know if this help you!

share|improve this answer
1  
No, In my case in my case there are few values and no data cells in ras1. suppose, I have a line/area(irregular) in the middle of ras1. For that particular line or area portion of ras1, I want to replace values with ras2. –  Dr. A.D.Prasad Jul 6 '12 at 4:16

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.