New answers tagged polygon
6
votes
Accepted
Finding distance between two first vertexes of line in QGIS
This Expression calculates the distance between the first and second vertex in the units of the layers coordinate reference system:
distance(point_n($geometry, 1), point_n($geometry, 2))
0
votes
Extracting coordinates from shapely geometry polygon with PyQGIS
If you want to avoid the dependency on Shapely etc then you can do it entirely with in the PyQGIS framework using vertexAt:
for i in range(bounds_rotated.vertexCount() - 1):
print(bounds_rotated....
0
votes
Extracting coordinates from shapely geometry polygon with PyQGIS
With the code below, I could also get the same shapely.geometry.polygon.Polygon-object:
from qgis.core import QgsProject
layer = QgsProject.instance().mapLayersByName("polygon")[0]
ext = ...
1
vote
Creating new and separate layer from hole(s) in multiple layers in QGIS
My start layer:
Delete holes:
Difference the delete hole layer with your start layer to create polygons where there were holes:
If you want to you can Merge the difference layer with your start ...
5
votes
Filtering polygons by name in one column of QGIS Attribute Table
This is a fairly simple task and the perfect use case for Python if you are up for trying a PyQGIS solution. The advantage here is that you don't even need to load your csv file into QGIS, you can ...
4
votes
Filtering polygons by name in one column of QGIS Attribute Table
You can import your csv as an non geographic table by choosing the No geometry option in the Geometry Definition section in the delimited text data manager window as shown below
Also note that ...
6
votes
Accepted
Filtering polygons by name in one column of QGIS Attribute Table
The expression is syntactically incorrect: string literals should be enclosed by single quotes, not double quotes; the SQL IN operator is usually used to specify multiple values and should be followed ...
5
votes
Accepted
Calculating area of intersection of two segmented polygons in QGIS
If you have many features QGIS processing tools will be fast.
My farms can overlap so I start with Dissolve (advanced option: keep disjoint features separate)
Intersect farms with villages
Field ...
4
votes
Calculating area of intersection of two segmented polygons in QGIS
You can perform this calculation in an expression rather than using the sequence you have described.
Using your villages layer this expression will calculate the area of intersection you can use this ...
1
vote
Creating buffer in QGIS without including surface of original polygon?
Geometry By Expression:
single_sided_buffer(geometry:=boundary( force_rhr( $geometry)), distance:=30)
Force right hand rule
Forces a geometry to respect the Right-Hand-Rule, in which the area
that ...
4
votes
Accepted
ST_ReducePrecision PostGIS function throwing an error
As mentioned in the comments... a grid size/tolerance of 0.0001 in WGS84 coordinates isn't very precise anymore (~11 meter, depending on where on earth you are, overview of precisions: openstreetmap ...
0
votes
Convert polyline features to polygons given the attributes using ArcGIS Pro
This is reverse of what you are doing. Input:
Use feature to polygon:
Create a copy of output and remove holes inside each polygon using field calculator
on field Shape:
def outRing(shp):
part=shp....
2
votes
Removing thin rectangles from a shapely polygon
If you want to try to keep the original shape as good as possible, you can shrink and grow the polygon again using e.g. "mitre" style buffers.
poly.buffer(-d, join_style="mitre")....
0
votes
KML polygon crossing 180th/anti-mederian
I was having the same problem in a program in python. It happens when the difference between the longitudes values are bigger then 180. In this case, just add 360 to the negative longitude.
def ...
3
votes
Dissolving polygons within other polygons and accumulated one of their values in QGIS
One possible approach is to first intersect the buildings with the cadastral units using the Intersection tool. This will give you the attributes from the cadastral layer in a new building layer.
You ...
4
votes
Rounding vertices of polygon to fixed number of decimal places in QGIS
You can use the "Snap points to grid" (native:snappointstogrid) processing algorithm https://docs.qgis.org/3.34/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html#snap-points-to-...
9
votes
Accepted
Rounding vertices of polygon to fixed number of decimal places in QGIS
THIS WILL OVERWRITE YOUR DATA (MAKE A COPY)
That's easy:
Open Field Calculator.
Insert this code: geom_from_wkt(geom_to_wkt(@geometry, 0))
Replace 0 with precision you need.
Check box Update existing ...
0
votes
Detecting if GPS coordinates fall within polygon of points?
This video explains it very clear to understand. https://youtu.be/RSXM9bgqxJM?si=zKVuHF_YtrcTS7Ec
3
votes
Finding all neighbors using GeoPandas
Another option is to spatial join the dataframe to itself, and groupby:
import geopandas as gpd
df = gpd.read_file(r"/home/bera/Desktop/gistest/world.shp")
df.plot(figsize=(20,10), column=&...
Top 50 recent answers are included
Related Tags
polygon × 4557qgis × 1704
arcgis-desktop × 658
r × 341
shapefile × 326
raster × 316
postgis × 308
python × 302
point × 290
line × 280
overlapping-features × 226
arcmap × 208
geometry × 196
intersection × 174
area × 159
vector × 149
clip × 142
splitting × 127
buffer × 122
polygon-creation × 113
geopandas × 112
qgis-3 × 109
merge × 107
arcpy × 103
distance × 95