1

It is possible to dissolve features in GeoPandas based on the attribute field. However, I would like to know how to dissolve features in GeoPandas using at least two attribute fields. Is it possible to do that?

1
  • 1
    Have an attempt with the groupby examples in github.com/geopandas/geopandas/issues/185, you can pass a list of columns to groupby. Then if you have any problems, edit your question and post your code and any exception text.
    – user2856
    Jul 21, 2020 at 4:40

1 Answer 1

5

Maybe I am not understanding the context of the original question but I got here via a Google search. The linked GitHub thread in the OP question comments seems over-engineerd. It seems to me that this can actually be done quite easily:

attrs = ["attr0", "attr1", "attr2"]
gdf_dissolved = gdf.dissolve(by=attrs, as_index=False)

as_index=False stops the grouping fields from being used as the index in gdf_dissolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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