17
votes
Summing up values of overlapping polygons in QGIS
QGIS 3.2
Thanks to new Union tool in QGIS 3.2, this has become quite easy!!!
What we do, is just use Union and Aggregate tools.
(1) Union (Processing Toolbox | Vetor Overlay | Union)
(2) We ...
17
votes
Accepted
Unions of SVG Point Markers In QGIS?
Since your symbol are quiet simple, you can use a simple marker and set the blending mode to lighten
15
votes
Accepted
Shapely polygon union results in strange artifacts of tiny, non-overlapping areas
This is typically a result of the the borders not fitting perfectly one next to another (and this is very easy to get with floating point coordinates).
As an example, I use the world dataset ...
12
votes
Accepted
Merging layers and excluding some of the products in QGIS
You can use the "Snap geometries to layer" tool by specifying the tolerance distance before "Union".
In the example, the green layer is snapped to the red layer so that the gap ...
11
votes
Accepted
Split a line when it crosses a polygon in R
Here is an answer that applies sf package functions to the reproducible data kindly provided by rcs.
library(sf)
A <- st_as_sfc("LINESTRING(458.1 768.23, 455.3 413.29, 522.3 325.77, 664.8 282.01, ...
11
votes
Accepted
Only union/dissolve intersecting or adjacent features to speed up query
I would look into using ST_ClusterDBSCAN. I have had tremendous success using this function to solve many cluster like geometric problems.
WITH clusters
AS(select st_clusterdbscan(geom, 0, 2) over()...
10
votes
Accepted
What does the ST_Union of the geometry column of two tables produce?
St_Union comes in two flavors, aggregate and simple.
In your query you are using the simple one that is creating the union of two single geometries.
What you are doing is cross joining your two ...
9
votes
Accepted
Getting the 'composite' of two polygon layers
One way to do this is to create a polygonal coverage from the linework of the inputs, and then spatially join this back to recover the parent attributes. The advantage of using this technique is that ...
8
votes
Finding and merging lines that touch in PostGIS?
Another option: use the PostGIS ST_LineMerge function. Here's the previous example redone with it:
WITH data(geom) AS (
VALUES
('LINESTRING (0 0, 1 1)'),
('LINESTRING (2 2, 1 1)'),...
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
Accepted
st_write fails for object created with st_difference using R?
GPKG column names must be unique and are case insensitive. Do you have any columns where the case-folded names are the same?
> any(duplicated(toupper(names(watlbahamas))))
[1] TRUE
Yes. Which ...
8
votes
Accepted
Creating Virtual Layer as union of multiple layers with same schema in QGIS
You can use python to print out the sql needed in the console, then copy paste it to the virtual layer. Add all layers to a group named surveyor and execute:
root = QgsProject.instance().layerTreeRoot(...
7
votes
Summing up values of overlapping polygons in QGIS
Before QGIS 3.2
This example requires MS-Excel function, along with SAGA in QGIS Processing Toolbox.
(1) Start Polygon self-intersection tool in QGIS Processing Toolbox | SAGA | Vector polygon ...
7
votes
Accepted
QGIS Union Error: multiple overlapping polygons created where only one should exist?
Your file "25015_f_padus" is a multipart shapefile, you need to convert the file to a single part shapefile before running the union tool. Go to Vector -> Geometry tool -> Multipart to ...
7
votes
Dissolve only overlapping polygons in R using sf
Here's my sample data:
> plot(bdf)
If you only care about whether polygons overlap and how they form clusters, then use st_intersects:
> st_intersects(bdf,bdf)
Sparse geometry binary ...
7
votes
Aggregating numerous polygons into one with PostGIS
You are looking for ST_Union; the function will attempt to dissolve the aggregated geometries:
SELECT ST_Union(<polygons>) AS geom
FROM <table>
GROUP BY
region
;
7
votes
Accepted
Merging and deleting with priority overlapping polygons in QGIS
First, run "Difference" from the Processing Toolbox and choose your Regions as Input and your Protected Areas as Overlay:
This difference layer will now have some holes:
Now run "...
6
votes
Add attribute from underlying polygon based on maximum shared area
I would suggest using the join attribute by location
Here is a few images of the dialog you would encounter.
Also, you could use the Spatial Query plugin which is now a core plugin in QGIS and the ...
6
votes
Accepted
How to self union a GeoDataFrame?
For the geometry you can use the unary_union (Shapely unary_union) predicate. The method will split all self-intersection geometries (Planar Graph)
# unary union of all the geometries of the ...
6
votes
Accepted
Union of Polygons with slightly shifted coordinates
Thanks a lot to @Vince for the hint.
Just added rounding (PostGIS: ST_SnapToGrid(geom, 0.000000001)) to my query and now it get's recognized as one polygon.
Downside of this is that my accuracy of ...
6
votes
Count overlapping features using Geopandas
It took quite a bit of head scratching, but I finally got there! Here is how you can do it in GeoPandas.
def count_overlapping_features(in_gdf):
# Get the name of the column containing the ...
6
votes
Accepted
Getting all of combinations of features found on two layers using QGIS
You can use Intersection tool in "Processing Toolbox Ctrl+Alt+T > Vector overlay" for this.
For example, I have two layers as below:
After using Intersection tool, you get a new layer:
...
6
votes
Accepted
Does UNION in PostGIS check for distinct geometries, or only other fields?
UNION does; row equality is checked on all returned columns and their types (using a type resolution sequence).
A thing to consider:
The implicit DISTINCT set operator here can be seen as partially ...
5
votes
Accepted
How to adapt a PostGIS query to modify the input table instead of creating a new table?
You cannot remove lines in the table you are currently selecting!
But you can use your solution in "Edit 1" with a temporary table:
BEGIN;
CREATE TEMP TABLE temp1 ON COMMIT DROP AS
SELECT
...
5
votes
Merge any and all adjacent polygons
I couldn't help thinking that your example is actually a raster and although you mentioned that you would like to merge based on "certain criteria (could be size)" I would like to give it a shot with ...
5
votes
ogr2ogr equivalent of QGIS Union
If you are interested in a "Spatial OR" between the layers 1 and 2 (i.e. intersection + difference 1-2 + difference 2-1), the union of the three elementary operations can be made with ogr2ogr in this ...
5
votes
Fast Union with Known Geographic Locations
As long as you are using PostGIS or the Python shapely module, your union operation is being computed by libgeos. GEOS already optimizes the union operation by taking advantage of the relative ...
5
votes
Accepted
Python script in ArcMap to fill a field in a shapefile based on information in other fields
def FillInfo(Info,Info_WB,Info_UESG,Info_GB,Info_Moo,Info_HHS,Info_PT,Info_SN,Info_SA):
returnItems = [Info_WB,Info_UESG,Info_GB,Info_Moo,Info_HHS,Info_PT,Info_SN,Info_SA]
returnItemsClean = [...
5
votes
Accepted
Summing Specific Features of Overlapping Layers
You don't necessarily need to merge your vector layers. Your title actually comes close to what you want, which is to perform a union.
Starting with inputs layer a and layer b, both of which have a ...
5
votes
Compound contiguous links to lines in a network and find isolated lines
You probably want to cluster your lines by intersection - use ST_ClusterDBSCAN with eps := 0:
SELECT *,
ST_ClusterDBSCAN(<geom>, 0, 1) OVER() AS _clst
FROM <lines>
;
to assign a ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
union × 289qgis × 73
postgis × 63
arcgis-desktop × 55
polygon × 39
merge × 28
dissolve × 22
shapefile × 21
r × 19
arcmap × 18
overlapping-features × 18
python × 16
intersection × 16
postgresql × 15
arcpy × 13
geometry × 10
buffer × 10
sf × 10
raster × 9
geopandas × 9
gdal × 8
arcgis-10.0 × 8
arcgis-pro × 8
spatial-join × 8
field-calculator × 7