The values for ALAND and AWATER will be added up for all of the states in a region. Read more about the dissolve function here.Īggregate the data using the ‘sum’ method on the ALAND and AWATER attributes (total land and water area). You can choice a suite of different summary functions including:Īnd more. To do this, you will add aggfunc = 'summaryfunction' to your dissolve call. Next, you will learn how to aggregate quantitative values in your attribute table when you perform a dissolve. However, you did not aggregate or summarize the attributes associated with each polygon. In the example above, you dissolved the state level polygons to a region level. axis ( 'equal' ) You can dissolve the boundaries between polygons based on an attribute label, such as region, as shown in this example. plot ( column = 'region', ax = ax ) # Set plot axis to equal ratioĪx. subplots ( figsize = ( 10, 6 )) # plot the data It’s always good to check your geometry before you begin to better know what you are working with.įig, ax = plt. Sometimes multi-polygons can cause problems when processing. geom_type you can see that you have a mix of single and multi polygons in your data. When you dissolve, you will create a new set polygons - one for each region in the United States. Source: ESRI.īelow you will dissolve the US states polygons by the region that each state is in. In the case above US states are dissolved to regions in the United States. When you dissolve polygons you remove interior boundaries of a set of polygons with the same attribute value and create one new "merged" (or combined) polygon for each attribute value. read_file ( "data/spatial-vector-lidar/usa/usa-states-census-2014.shp" ) Dissolve Polygons Based On an Attribute with Geopandasĭissolving polygons entails combining polygons based upon a unique attribute value and removing the interior geometry.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |