Select to view content in your preferred language

Raster to polygon,output polygons are larger than input raster

6823
18
05-19-2015 12:42 PM
DitlevReventlow
Deactivated User

Hey everyone.

I am using a raster layer (raster1) to clip another raster layer (raster2). As far as I understand I need to use the raster to polygon tool on raster 1 to be able to do this as you cannot clip a raster with another raster. If this is wrongly interpreted, please let me know.

My problem is that the polygon output is bigger the the raster input. The polygons are filling out many of the gabs between the raster pixel, resulting in a polygon that is much larger than the input raster. How can I make it "finer" so that It only draws polygons where there is actually a relevant pixel?

Thank you very much.

Best regards

Ditlev Reventlow.

Tags (1)
0 Kudos
18 Replies
DanPatterson_Retired
MVP Emeritus

You need to set the output extent in the Raster to polygon tool, using the Environments tab to do so.  Extents and other such things, should be confirmed before using any tools in Arctoolbox, and when working with raster data in general.  The defaults are rarely what you want or expect.

DitlevReventlow
Deactivated User

Hey Dan.

Thank you for this.

I went into Environment --> processing extent. Here I set the extent to be equivalent to the raster layer that I am converting. The result of this is still the same as before. The polygons are still filling up gaps.

Maybe I am not understanding you correctly. What do you mean with the polygon tool? There was no such possibility when I chose the extent.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Other options... In arctoolbox, check out the extraction toolset and try extract by mask, extract by extent etc

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

Hi Ditlev,

If the spatial resolution is same for Raster1 and Raster2, you could use Raster Calculator.

Con(IsNull("Raster1"),0, "Raster2")



Think Location
EricRice
Esri Regular Contributor

Ditlev,

You can most certainly clip a raster using another raster.  Converting to polygon is not the way to go.  The clip tool inside Data Management Tools > Raster > Raster Processing is probably the one I'd suggest since it doesn't require any extensions.  If you have Spatial Analyst then Extract by Mask is a viable alternative.

Best,

Eric

DitlevReventlow
Deactivated User

When I use extract by mask, then the resulting raster has the same problem as when I did the procedure with the polygon - gabs are filled out. I have changed the extent to be corresponding to the input raster so this should be okay. And when I try to use the Data Management clip tool, then the whole image the raster output is completely corresponding to the raster input. So it is as if the output extent is not working as it should, even though I have chosen an output extent, and I have also set the processing extent to be equivalent to the output extent.

I tried to do it in raster calculator as well, and I got the extent to work here. However, the raster output doesn't have the value of the input raster which I need as well. Can you add something to the command in raster calculator to include this information as well? 

0 Kudos
DanPatterson_Retired
MVP Emeritus

​You have to set raster extents IN each tool you use .  There is an environments button on each tool, use it, set your properties, since not all Global properties set elsewhere are used.  Do this for all ArcToolbox tools,

0 Kudos
EricRice
Esri Regular Contributor

Can you post some screen shots?  If you use Clip_Management you don't need to set the extent environment because the extent control is already in the tool interface.  The extent in the tool will override the environment for extent.  In all cases where an environment setting is exposed as a parameter in a tool, the tool parameter takes precedent over environment settings.

"How can I make it "finer" so that It only draws polygons where there is actually a relevant pixel?"

     - This sentence is throwing me for a loop.  Are you trying to clip raster 1 with specific (relevant) values from raster 2?

Eric

0 Kudos
DitlevReventlow
Deactivated User

Dan,

This is what I believe that I have tried. It is just not working out for me. You mean to set the extent to be equal to the raster that you do the clipping operation with (in this case raster 2), right?

Eric

That sentence is from when I thought that you had to convert raster1 to a polygon to perform the operation. This "clipping" layer is right now a raster, but whether this other layer is polygon or raster doesn't matter, it is just what is easiest.

Maybe it is easier if I explain what I actually want to do, Iam just afraid that It will get to technical.

I have a Evapotranspiration change Map (raster 2) and a map of land use change (raster 1). Raster 2 stores information in mm about the amount of evapotranspiration and raster 1 stores information about which type of land use change takes place.

What I want to do is to clip raster2 with raster 1 so to get the information about what the different land use changes means for the change in evapotranspiration. Therefore I want that the output raster corresponds to the extent of raster 1. And only correspond to the extent of raster 1, not filling in gaps between the pixels. And furthermore to have information about what land use change that takes place and what this means for change in evaportranspiration (so basically attribute fields from both rasters)

I have attached a document with screen shots that shows what I have done, and why it didn't work. I have tried both converting to polygon, raster calculator, extract by mask and clip (Data Management) all without luck. As said above in the comment to Dan, I have set the processing extent in all the cases to be equal to raster 1 so this should be okay. So I don't understand why it doesn't work.

Thank you very much for the help all of you, very appreciated, I hope that I am explaining things clearly!

0 Kudos