12
votes
Accepted
Adding different types of geometry to layer in QGIS
If you mean adding them to a QGIS layer, the answer is 'No'. It is not possible. This is the nature of the QGIS layer. But somehow (maybe by a script) you may export layers, which have different ...
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
Using multiple XY fields for geometry definition in point layer in QGIS
Use a Geometry Generator style for your point layer with an expression that creates a point based on x/y coordinate values for surveyed locations if it exists and else create a point based on x/y ...
11
votes
Accepted
Deleting parts of MultiPolygon based on area using PyQGIS
You can make a new part list from the MultiPolygon instead of deleting the parts.
layer = iface.activeLayer()
# Minimum area threshold
minimum_area = 2000
layer.startEditing()
# Loop through all ...
10
votes
Accepted
Smoothing round border of created buffer in QGIS
This is a case for a convex or concave hull - depending how much additional space you want to include.
Concave hull gives you more flexibility: there is just one single convex hull per geometry, but ...
10
votes
Quantizing the value of straightness or waviness of line segment in QGIS
You can use QGIS expression with the sinuosity() function:
sinuosity($geometry)
Returns the sinuosity of a curve, which is the ratio of the curve
length to the straight (2D) distance between its ...
10
votes
Accepted
Why angleAtVertex() returns different value than angle_at_vertex in Field Calculator using PyQGIS
angle_at_vertex() returns the angle in degrees:
anlge_at_vertex($geometry, 0) -> 38.618825502347555 degree
angleAtVertex() returns the angle in radians:
feature.geometry().angleAtVertex(0) -> 0....
9
votes
Accepted
Using 'shared_paths' function in QGIS Expression Dialog
The function shared_paths() returns the common space two lines share - so similar to the interesection of two lines. The difference is that shared_parths()
A) only works for lines and
B) (more ...
8
votes
Categorising data points along transect using QGIS
I just wanted to add another solution in case
the intervals are not intended to be equal,
the interval 'names' are not necessarily sequential
the intervals are represented by line geometries, and
you ...
8
votes
Accepted
Changing orientation of all polygons at once with numeric value in QGIS
You need to run your expression in the processing tool "Geometry by Expression". This will actually change the geometry and add it to a new layer.
Running this in the Field Calculator does ...
7
votes
Calculating area of polygon intersection with condition
This expression appears to be working just fine:
area(
intersection(
$geometry,
aggregate(
'Layer_1',
'collect',
$geometry,
&...
7
votes
Accepted
Check Geometries Plugin - attribute value in results
I guess it is the value of the "thinness" parameter
7
votes
Accepted
How to join geodataframe itself
You can use the solution of How to use geopandas or shapely to find nearest point in same geodataframe with a for loop ( generally not recommended with Pandas).
df = gpd.read_file("points.shp&...
7
votes
Finding overlapping polygons within the same layer in QGIS
You can create a Virtual Layer with DB Manager which joins the table to itself on intersecting polygons, where the id isnt the same.
You need a unique identifier field, mine is named id. My layer is ...
6
votes
Accepted
Calculating area of polygon intersection with condition
You can use an overlay_intersect() function for that, as it contains an (optional) filter argument:
area(
intersection (
$geometry,
collect_geometries(
...
6
votes
Why simplify algorithm has no effect on input in QGIS?
Your data contains 2212 features, each one having exactly two vertices: the start vertex and the end vertex. There is nothing to simplify as your data stand right now.
6
votes
Accepted
ST_Intersection EMPTY return type differs from version 3.0.7 to version 3.3.2
Both queries are returning the empty set because there is no intersection of geometries, meaning no element of the table intersects with the envelope. There is, however, an element whose bounding box ...
6
votes
Accepted
Categorising data points along transect using QGIS
Use this expression: it will automatically adapt if you change the interval (2nd last line). See below for explanation:
array_foreach(
generate_series(65,90),
char(@element)
)[floor (
...
6
votes
Changing orientation of all polygons at once with numeric value in QGIS
Update the "geometry" field in the field calculator, then the desired result should "happen". Please be aware that this will change your original geometry, so maybe export first ...
6
votes
Deleting NULL geometries and duplicate nodes from table using PostGIS
This requires a procedural execution of dynamic SQL - best applied with a DO block.
Since we are only looking at modifying columns of type GEOMETRY, we can identify the respective relations easily ...
6
votes
Accepted
Is there a common method for measuring "curviness" of a line?
One measure is Sinuosity which is the line length divided by the shortest distance from the line start and end points:
select id,
st_length(geom)/st_distance(st_startpoint(geom), st_endpoint(...
6
votes
Accepted
Generating offset line from MultiLineString in QGIS
Try the "Translate" tool in the Processing Toolbox (Ctrl+Alt+T) (under Vector Geometry).
Set the x-axis to whatever distance you want to create the copy:
Output similar to the following:
5
votes
Accepted
Why simplify algorithm has no effect on input in QGIS?
Since the QGIS version 3.26 the Dissolve tool has a new option: Keep disjoint features separate. Check this option; your line features will be reduced from 2,212 to 41 keeping the whole line structure ...
5
votes
Accepted
Export list of shapely.geometry.polygons as Esri shapefile
You can easily save them to a shapefile using geopandas.
import geopandas as gpd
from shapely.geometry import Polygon
# polygons sample
polygons = [Polygon([(0, 0), (1, 1), (1, 0)]),
...
5
votes
Accepted
Avoiding label identical attributes on duplicate geometries in QGIS
This is not optimal, but I was only able to find this solution. It would be better to call it a workaround. It may display a different result for your data.
array_to_string(
array_distinct(
...
5
votes
Accepted
Create layer from an array of geometries in OpenLayers?
You will need an array of features, not just geometries. Create features containing the identifying properties of each ope, then read the geometry into OpenLayers format and set it in the feature. ...
5
votes
Accepted
Getting polygon's geometry from layer
A given layer will have multiple features (could be one, but could be many).
So once you have the layer, you need to iterate over the features, and then get the geometry for each feature eg
# Get the ...
5
votes
Smoothing corners in polyline using PyQGIS
I know what you are talking about because I performed the same task in my geodesy/surveying course. At that time it was done manually with paper, ruler and pencil.
Let's assume there is a polyline ...
5
votes
Accepted
Unifying touching polygon within polygon geometry in PostGIS
I can recommend this way, it is very fast.
Each group of polygons is assigned the same id if they are 0 distance apart, and number at least 2, using ST_ClusterDBSCAN.
Single polygons will get NULL as ...
5
votes
Accepted
From Geodataframe to PostGIS
You shouldnt need dtype={'geom': Geometry(geometry_type='GEOMETRY', srid= 4326)}.
Try without it and use .to_postgis:
import geopandas as gpd
from sqlalchemy import create_engine
gdf = gpd.read_file(...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
geometry × 1815qgis × 408
postgis × 280
python × 193
polygon × 186
arcpy × 164
arcgis-desktop × 119
postgresql × 119
shapefile × 92
pyqgis × 86
coordinate-system × 82
sql × 73
sql-server × 66
line × 57
geopandas × 57
intersection × 55
shapely × 51
arcmap × 49
qgis-3 × 48
point × 45
geojson × 42
linestring × 39
well-known-text × 39
vector × 38
ogr × 38