There are two ways of calculating, raster on raster or vector on vector. radouxju has given an instruction on raster on raster but I believe the vector on vector might be more what you're after.
Convert your raster into polygons using Raster to Polygon, don't simplify the polygons for more accurate results.
Percentage of cover for the overlaying polygons ...
convert your woods polygon to raster (feature to raster) with the extent of your aspect layer
make it a binary layer (raster calculator : Con(IsNull("woods"), 0, 1))
use zonal statistics as a table to have the mean of your wood layer (this mean will be the percentage of the area covered by wood)
You need to be very careful using tabulate area. The tool is helpful, but has some "gotchas".
Watch out for sending in overlapping zones. Zones cannot be overlapping as the vector is rasterized and two zones cannot be represented in the same cell. Its a bummer Esri doesn't handle this out-of-the-box.
Setting snap raster is great, but you should also set ...
try something like this:
import numpy as np
area_per_pixel = 100 #example...you change to suit
r = gdal.Open(rasterfile)
band = 1
raster_arr = np.array(r.GetRasterBand(band).ReadAsArray())
for cover in np.unique(raster_arr):
tot_num_pixels = np.sum(raster_arr == cover)
area = tot_num_pixels * area_per_pixel
print cover, area
The cell size is not used to allow adjustment. You have to manually adjust the resolution of the coarser raster to make it match the finer raster (or set the Cell size raster analysis environment to Minimum of Inputs).
"Some of the area values in ...
Zonal Histogram (QGIS 3.4) has worked successfully for me to derive land cover totals (from a TIF) per county (held as shapefile).
I was searching for an answer to this exact same question. However, a different question (about an equivalent for Zonal Statistics) was where I found this information. To me, Zonal Histogram seems to be a more direct equivalent ...
Tabulate area is the right tool for this job, but it yields the area expressed in the coordinate system of your data. In your case, the coordinate system seems to be a geographic coordinate system (Latitude/longitude, e.g. WGS84). Indeed, your small values indicate that your unit is likely to be degrees.
Therefore I suggest that you "project" your data ...
Based on the information you provided, resolution, my guess for your units is meters. Also, to find the total area of each district you could follow this tutorial Calculating Polygon Area in ArcMap
You will have to create a new field then calculate the area of polygons, it is straightforward workflow
Select the “Open Attribute Table” to open up the ...
You need to add a new field that defines the corresponding class name for each value in the attribute table. Tabulate Area does not consider the labels defined in the symbology. You should clearly define the classes in the attribute table, then when using Tabulate Area tool, you can choose the field that has the land use class names.
Please note that if ...
You could use a search cursor and iterate all the rows of the polygon and do the analysis:
Modelbuilder is also an option:
You're pretty close at the moment. The tools you can use are in the same toolbox as the Tabulate Area tool. Have a look at Zonal Geometry. It can calculate the area for each zone.
Zonal Statistics might also be useful depending on your particular datasets.
Alternatively, you could convert your rasters to polygons and perform a union or interesection. ...
I think that there is a simple way to achieve this :
Create a new fild to concatenate code and pcode ( str(!code!) + "_" + !pcode!)
Use summary statistics to get the maximum area value for each unique code_pcode
Join this value to the initial table (based on code field)
if necessary, select the rows where area = max_area
Alright, I figured it out. The problem was with projections. The raster was in an unprojected WGS coordinate system. I assume that while loaded in ArcMap, it was projected on-the-fly and therefore the results showed.
Here is how you can do that, I think. I am following this example:
# example data
p <- shapefile(system.file("external/lux.shp", package="raster"))[, 1]
p$Color <- rep(c('blue', 'green', 'red'), 4)
p <- p[,2]
z <- raster(p, nrow=2, ncol=2, vals=1:4)
names(z) <- 'Zone'
z <- as(z, '...
When I use Tabulate area tool in raster with resolutin 5 x 5m per pixel (EPSG: 5514 - Czech rep. Krovak East North coordinate system), the result is in square meters per zone. So it means in zone with only one pixel, result will be 25 square meters.
Here's a way.
PLEASE NOTE: this calculates area in degrees, which makes no sense - but otherwise doesn't impact the illustration. You should calculate area in a coordinate system that is sensible for your data. (Use rgdal to project to a local Lambert Azimuthal Equal Area projection or similar if your data are in longitude/latitude, or otherwise ...
Assuming you want to use it in Model Builder, I suggest you a "Calculate Value" script as follows:
You do not say where you would like this output to appear, or the version of ArcGIS for Desktop that you are using, but if it is in an ArcMap layout at 10.1 or later, then the way I would do it is by using the Intersect tool first, and then the Data Access (arcpy.da) and Mapping (arcpy.mapping) modules of ArcPy.
The basic idea is to use arcpy.da cursors to ...
There is an internal conversion of the polygons to raster when you process a tabulate area (same with zonal histogram and zonal statistics). Therefore even if your polygons align with the raster cells, you could have a feature to raster conversion that ends up with non matching grids. This can be fixed by setting the tool environment with equal pixel size ...
For two polygon features, I like Mike's method. If you are working with raster feature and/or zone data, I personally prefer using PolygonToRaster and Combine, shown logically in pseudo-code:
Zone_Raster = PolygonToRaster(Zone_Polygon, re-scaled & snapped to Feature_Raster)
Combined_Raster = Combine(Zone_Raster, Feature_Raster)
This outputs a new ...