18

How do you take a vector layer with overlapping polygons and turn it into a raster where each cell counts the number of polygons containing that cell?

We are looking at polygons of fire burn areas between 1976 to 2000 and want to see how many fires would be contained in each raster cell.

2 Answers 2

23

Do this in three steps: break the polygons into their component parts, count the overlaps, and convert to raster. This avoids the potentially huge computational cost of separately converting every polygon to a raster and combining those rasters.

  1. Union (in the Geoprocessing menu) breaks the polygons into their parts.

    Unfortunately, each overlap is duplicated in the output: it has one identical copy for each original polygon covering it. Therefore

  2. Dissolve (again in the Geoprocessing menu) will merge overlapping parts, provided you can find a way to uniquely identify them. Read through the dialog: towards the end, you will have an option to compute "statistics." Choose any field that may have identified the original polygons and ask for a count.

    In many cases the combination of polygon area and perimeter will uniquely identify the parts. If not, you can add more geometric properties in additional fields, such as coordinates of the centroid, until you have accumulated enough information to distinguish every feature.

    The resulting layer has one feature for each polygon overlap and some kind of "count" field counting the number of overlaps.

  3. Convert that to a raster, using the "count" field for the attributes.


For example, here are some overlapping polygons and their identifiers with the attribute table shown:

enter image description here

After the second step we have one record for each overlapping region along with a count which can already be used to symbolize the amount of overlap:

enter image description here

The rest is easy--and it's just a single rasterization operation.

5
  • This vector method works great, too, except when applied to hundreds of thousands of polygons with many overlaps on a computer with limited memory...
    – ccn
    Commented Feb 14, 2013 at 23:09
  • @ccn When there are more polygons than ArcGIS can handle, split the dataset into parts that it can process. The output will be several rasters--but not thousands or millions of them--which are then straightforward to sum. Another advantage of using Union is that with almost the same workflow it can address the situation where the polygons reside in multiple datasets (which is usually a bad database design but unfortunately common): one simply unions all the input datasets at once.
    – whuber
    Commented Feb 14, 2013 at 23:13
  • @ccn (Continued) the point you bring up comes down to this: when is it better to rasterize the polygons and use raster operations to merge them compared to using vector operations (union) followed by rasterization? Vector operations will bog down when the features are digitized with more detail than needed, endowing them with too many vertices. In these extreme circumstances the raster approach could be better (although first simplifying the polygons might be a superior option). In all other situations, though, rasterizing each polygon separately is a huge waste of computer and human time.
    – whuber
    Commented Feb 14, 2013 at 23:18
  • 1
    +1 for a vector based solution. To put things into perspective here, burn perimeter data is never very large. For example, the entire MTBS burn perimeter dataset (USA including Alaska) for 1984 - 2010 contains ~ 19000 polygons. Either a vector or raster based approach will work just fine.
    – Aaron
    Commented Feb 15, 2013 at 16:45
  • @Aaron Thank you for the perspective. To do the conterminous USA at once at any reasonable resolution (e.g., 100m) you would need, say, a raster of 50000 columns and 30000 rows containing 1,500,000,000 cells. Generating 19,000 such rasters--even accounting for the built in compression--and then performing 19,000 * 1500000000 = about 30000 billion additions--would require quite some time! If instead each polygon used, say, 100 vertices (which is very detailed), the union involves 1,900,000 vertices and is a O(n log(n)) operation; in principle (but not in ArcGIS :-) that takes less than 1 sec.
    – whuber
    Commented Feb 15, 2013 at 16:56
1

The following post has a somewhat similar question that you could find a related solution: Creating a raster surface of overlaps from vector polygon shapefiles?.

For this computationally fast and simple raster approach, you will need to (1) separate the overlapping polygons into separate layers (presumably by year for fire polygons) using Select By Attributes in ModelBuilder with an iterator or a script tool, (2) convert each Polygon to Raster with the MAXIMUM_COMBINED_AREA cell assignment (ensuring same cell size, snap raster, and that the extent remains the same as the entire set of polygons) - using a constant field value (e.g. use the year field or rows that have all 1s) to convert on (again use ModelBuilder with an iterator or Python script to help automate), and then (3) apply the following Spatial Analyst tool: Cell Statistics - use the statistics_type VARIETY if each raster has a unique value such as the year or SUM if all rasters cell values are 1s - be sure to check to ignore NoData.

The intermediate rasters (from the prior conversion) may be deleted or are ready to be used in subsequent raster analyses.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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