Select to view content in your preferred language

land use change by percentage

739
3
Jump to solution
06-11-2012 05:32 AM
BethanyNoordegraaf
New Contributor
Hello,

I have a land use shapefile that I am trying to modify in python. I have created a buffer around surface water polygons and I want to convert a percentage of the land use types that fall within the buffer to a specific land use. For example, within a 100m buffer of my stream I want to ensure that at least 10% of the region is 'naturally vegetated'. If it is not, then I want to convert 10% of changeable land (i.e. row crops) to 'vegetated'. If anyone could assist me with this one, it would be greatly appreciated.

Thanks in advance,

Bethany
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
NobbirAhmed
Esri Regular Contributor
Try this workflow:

Add a field ORIG_AREA of type Double to your buff_water. In the attribute table, right-click on ORIG_AREA and select Field Calculator. Set ORIG_AERA equal to Shape_Area. I'm making a duplicate of the Shape area for use in a later step.

Use Make Feature Layer to make a layer from your vegetation polygons (even if you are in ArcMap). Pay special attention to Field Info parameter and don't forget to check mark the Use Ratio Policy for Shape field (see screenshot below). Name the output as vegetation_Layer.

[ATTACH=CONFIG]15119[/ATTACH]

Run Clip tool with with buff_water as input and vegetation_Layer as clip features. Name the output of Clip as buff_water_Clip. This output will look like vegetation layer but will contain attributes of buff_water.

Add a field VEG_RATIO of type Double to buff_water_Clip. This field will contain the percentage of vegetation in each buff_water polygon - here is how you calculate the percentage.

Open the attribute table of buff_water_Clip. Right-click on VEG_RATIO field and select Field Calculator ...
- Select Python as parser.
In the code block set VEG_RATIO as:

( !Shape_Area!/ !ORIG_AREA!) * 100


Add another field called VEG_TYPE of type TEXT/string to buff_water_Clip table.

Now calculate VEG_TYPE using Calculate Field tool. Open Calculate Field tool and set parameter values using the screenshot below:

[ATTACH=CONFIG]15118[/ATTACH]

In case the image is not clear, use this as Expression:

calc_veg_type(!VEG_RATIO!)


Use use this chunk of code in Code Block section - change the return value as per your requirements:

def calc_veg_type(field):     if field >= 10.0:         return 'Vegetated'     return 'Not vegetated'

View solution in original post

0 Kudos
3 Replies
NobbirAhmed
Esri Regular Contributor
Try this workflow:

Add a field ORIG_AREA of type Double to your buff_water. In the attribute table, right-click on ORIG_AREA and select Field Calculator. Set ORIG_AERA equal to Shape_Area. I'm making a duplicate of the Shape area for use in a later step.

Use Make Feature Layer to make a layer from your vegetation polygons (even if you are in ArcMap). Pay special attention to Field Info parameter and don't forget to check mark the Use Ratio Policy for Shape field (see screenshot below). Name the output as vegetation_Layer.

[ATTACH=CONFIG]15119[/ATTACH]

Run Clip tool with with buff_water as input and vegetation_Layer as clip features. Name the output of Clip as buff_water_Clip. This output will look like vegetation layer but will contain attributes of buff_water.

Add a field VEG_RATIO of type Double to buff_water_Clip. This field will contain the percentage of vegetation in each buff_water polygon - here is how you calculate the percentage.

Open the attribute table of buff_water_Clip. Right-click on VEG_RATIO field and select Field Calculator ...
- Select Python as parser.
In the code block set VEG_RATIO as:

( !Shape_Area!/ !ORIG_AREA!) * 100


Add another field called VEG_TYPE of type TEXT/string to buff_water_Clip table.

Now calculate VEG_TYPE using Calculate Field tool. Open Calculate Field tool and set parameter values using the screenshot below:

[ATTACH=CONFIG]15118[/ATTACH]

In case the image is not clear, use this as Expression:

calc_veg_type(!VEG_RATIO!)


Use use this chunk of code in Code Block section - change the return value as per your requirements:

def calc_veg_type(field):     if field >= 10.0:         return 'Vegetated'     return 'Not vegetated'
0 Kudos
BethanyNoordegraaf
New Contributor
Hello,

I have a land use shapefile that I am trying to modify in python. I have created a buffer around surface water polygons and I want to convert a percentage of the land use types that fall within the buffer to a specific land use. For example, within a 100m buffer of my stream I want to ensure that at least 10% of the region is 'naturally vegetated'. If it is not, then I want to convert 10% of changeable land (i.e. row crops) to 'vegetated'. If anyone could assist me with this one, it would be greatly appreciated.

Thanks in advance,

Bethany


Thank-you Nobbir, this work flow has been very helpful:)
0 Kudos
NobbirAhmed
Esri Regular Contributor
Glad to know 🙂

If that solves your question, could you mark the thread as 'Answered'?
0 Kudos