25 votes
Accepted

Dissolving not based on attribute in GeoPandas

You will lose all attributes but unary_union will return one big multipolygon which you can turn into singleparts with .geoms: import geopandas as gpd df = gpd.read_file(r"C:\Test\New_Shapefile.shp") ...
BERA's user avatar
  • 68.8k
21 votes
Accepted

Styling polygon layer as dissolved with QGIS Geometry generator

You can now do this with the geometry generator in QGIS 2.99/3.0 by using buffer(collect($geometry), 0) in the expression builder. The new collect() aggregate function collects all the feature ...
she_weeds's user avatar
  • 10.8k
18 votes
Accepted

Cleaning large Shapefile using v.clean in order to dissolve features?

The source data seems to be rather hard to handle as vectors as you have noticed. However, this workaroung that goes through an intermediate raster file works well and it is very fast. 1) Use ...
user30184's user avatar
  • 63k
15 votes
Accepted

Rendering polygons ordered by size in QGIS

Most data providers do not guarantee any order in the way they deliver features. While an apparently stable order is often a side effect of the order in which features are stored in files, one shouldn'...
Matthias Kuhn's user avatar
15 votes

geopandas dissolve overlapping polygons

Using this example GeoSeries: s = geopandas.GeoSeries([Polygon([(0, 0), (0, 2), (2, 2), (2, 0)]), Polygon([(0, 1), (0, 3), (2, 3), (2, 1)]),Polygon([(1, 0), (1, 2), (3, 2), (3, 0)]), Polygon([(4, 4), ...
joris's user avatar
  • 3,853
14 votes

Styling polygon layer as dissolved with QGIS Geometry generator

I've tried using the Geometry Generator with no success, and decided on a "Virtual layer" and a SQL query SELECT st_union(geometry) FROM layer_name You need to replace "layer_name"...
Klas Karlsson's user avatar
14 votes
Accepted

Trouble when Dissolving Geopandas Polygons

Simple dissolve by GeoDataFrame field (Aggregation with dissolve) import geopandas as gpd world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) continents = world.dissolve('continent') ...
gene's user avatar
  • 54.4k
12 votes

Removing lines from inside polygon in QGIS

You can use the QGIS-Processing tool Delete holes for that. Just pass the polygon layer with holes, the algorithm will remove all inner rings (aka. holes) for each polygon automatically.
Germán Carrillo's user avatar
12 votes
Accepted

Dissolving selected geometries in-place using PyQGIS

If I'm not misunderstanding your question, the code below will do the trick. layer = iface.activeLayer() ids = layer.selectedFeatureIds() fs = list(layer.selectedFeatures()) # fs: features # combine ...
Kadir Şahbaz's user avatar
12 votes

Dissolving polygons contained within the same larger polygon in QGIS

If you want to dissolve in-place: Start edit mode for the layer. Select the bounding and interior polygons Click "Merge selected features" button () in the Advanced digitizing Toolbar. ...
Kadir Şahbaz's user avatar
12 votes

Dissolving polygon on QGIS

First, use "Vector geometry > Snap geometries to layer" tool. Use the grid layer as input and reference layer with tolerance 0.00001. Then, use "Dissolve" tool.
Kadir Şahbaz's user avatar
10 votes
Accepted

Dissolve overlapping polygons according to percent overlap using PostGIS?

This can be easily accomplished using PostGIS. Preview the results using a modified version of the query below: SELECT a.id, b.id, ST_Area(a.shape), ST_Area(b.shape) , 100*(ST_Area(...
John Reiser's user avatar
  • 1,136
10 votes

geopandas dissolve overlapping polygons

I found a workaround: def explode(gdf): """ Will explode the geodataframe's muti-part geometries into single geometries. Each row containing a multi-part geometry will be split into ...
RutgerH's user avatar
  • 3,245
10 votes
Accepted

Dissolving polygons that intersects with line in Geometry Generator

@snaileater already explained why your expression wont work. Here is how you can do it with QGIS 3.16+ (explanation as comments in expression): buffer( -- dissolve result collect_geometries( -- ...
MrXsquared's user avatar
10 votes
Accepted

Dissolving polygons that intersects in QGIS

You can dissolve without a dissolve field but Im not sure if that is what you want. I suspect it is: Dissolve Multipart to singleparts Field calculate @row_number Intersect output with your original ...
BERA's user avatar
  • 68.8k
10 votes

Dissolving polygons contained within the same larger polygon in QGIS

To get as a different layer from the original one, use the following steps. Select the polygons you want to dissolve Run "Vector Geometry" -> "Dissolve tool". (Check "...
Kadir Şahbaz's user avatar
10 votes
Accepted

Dissolving polygons contained within the same larger polygon in QGIS

To merge all the features of layer 'polygon2' inside the same same polygon from layer 'polygon1' automatically (without manual selection), use Menu Processing / Toolbox / Aggregate (see documentation) ...
Babel's user avatar
  • 67.2k
9 votes
Accepted

Deleting 'garbage' nodes after polygon dissolve

I tested your shapefile and used GRASS algorithm v.clean from the Processing Toolbox. I applied snap as the cleaning tool and used a threshold of 5 which seemed to have cleaned up your shapefile a ...
Joseph's user avatar
  • 75.3k
9 votes

Dissolving shapefile but retaining a list of original attribute value in QGIS

It is now more than one year from your post... From QGIS 2.16, new Aggregates functions became available. One of the new expression is concatenate(). Your Sample concatenate() Open the attribute ...
Kazuhito's user avatar
  • 30.5k
9 votes
Accepted

Dissolving featurecollection in google earth engine?

Your simplest solution is the following. var joinedFeatures = DMDP.union() Map.addLayer(joinedFeatures) Then set the colours that you prefer before adding it to the map.
Sean Roulet's user avatar
  • 2,170
9 votes

Making dissolve output as temporary layer using PyQGIS

In more recent versions of QGIS, do not forget to include the 'SEPARATE_DISJOINT' argument, see the Changelog for QGIS 3.26 for more details. So, your code may look like this: from qgis import ...
Taras's user avatar
  • 31.3k
8 votes
Accepted

Group and union polygons that share a border in R

Here's a function that takes an sf polygons object and clusters all features within a threshold distance, then merges the features. So starting with N features you end up with M<=N features: ...
Spacedman's user avatar
  • 62.5k
8 votes

Rendering polygons ordered by size in QGIS

You need to use Union Tool from Vector -> Geoprocessing tools -> Union. This should give you the correct topology. Or, you can use difference tool repeatedly to get the difference between big ...
ahmadhanb's user avatar
  • 40.4k
8 votes
Accepted

Dissolving using PyQGIS?

The easiest approach is to run the algorithm through the GUI, and then look in the Processing "history". You'll see the equivalent Python command shown there for the operation you just performed via ...
ndawson's user avatar
  • 27.4k
8 votes

Dissolving polygons that intersects with line in Geometry Generator

Intersects doesn't return a geometry. It only returns true or 1 when the two passed geometries intersect. That explains why collect won't work either. You should build your formula step by step and ...
Snaileater's user avatar
  • 5,703
8 votes
Accepted

Dissolving overlapping polygons without common attribute in QGIS

Let's assume there are nine features in the 'grid_test' (reddish) layer, see the image below. Use the the GDAL's "Dissolve" (GDAL > Vector geoprocessing > Dissolve) from the ...
Taras's user avatar
  • 31.3k
8 votes

Dissolving polygons that intersects in QGIS

First you run Dissolve, then you use Multi to singleparts to separate your blobs from each other. This removes individual attributes, but if you have those, you could run Dissolve using any of these ...
Erik's user avatar
  • 15.7k
8 votes
Accepted

QGIS: Dissolve adjacent small polygons

"Select by expression" $area<100 (or "area"<100 if you want to use your area field) "Eliminate Selected Polygons": This algorithm combines selected polygons of the ...
BERA's user avatar
  • 68.8k
7 votes
Accepted

Merging overlapping polygons with SpatiaLite

Here is a step-wise process. Queries were made with Spatialite-gui and visualizations with OpenJUMP. Take some points into table "points" with an attribute "radius". Buffer points by taking the ...
user30184's user avatar
  • 63k
7 votes
Accepted

PostGIS dissolve geometries from shapefiles

You want ST_Union for your geometry instead of sum: select distinct ST_Union(geom) as geom, county as county, sum(schools) as schools, sum(childcare), sum(respopint) as rez, etc... into countyreport ...
HeikkiVesanto's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible