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")
...
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 ...
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 ...
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'...
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), ...
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"...
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')
...
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.
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 ...
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.
...
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.
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(...
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
...
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( -- ...
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 ...
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 "...
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) ...
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 ...
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 ...
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.
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 ...
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:
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
dissolve × 525qgis × 183
arcgis-desktop × 161
polygon × 78
merge × 64
arcmap × 45
python × 40
postgis × 39
shapefile × 31
arcpy × 30
geopandas × 30
buffer × 26
overlapping-features × 23
union × 22
arcgis-10.0 × 20
fields-attributes × 19
arcgis-10.1 × 17
arcgis-10.2 × 16
r × 15
pyqgis × 14
multipart × 14
modelbuilder × 13
qgis-3 × 12
arcgis-10.3 × 12
vector × 12