Skip to main content

New answers tagged

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))
juto96's user avatar
  • 560
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....
Ian Turton's user avatar
  • 82.6k
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 = ...
Taras's user avatar
  • 33.7k
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 ...
Bera's user avatar
  • 76.2k
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 ...
Ben W's user avatar
  • 22.6k
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 ...
Cheruiyot Vincent's user avatar
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 ...
Andrea Giudiceandrea's user avatar
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 ...
Bera's user avatar
  • 76.2k
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 ...
Sethinacan's user avatar
  • 1,850
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 ...
Bera's user avatar
  • 76.2k
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 ...
Pieter's user avatar
  • 3,804
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....
FelixIP's user avatar
  • 23.2k
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")....
Pieter's user avatar
  • 3,804
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 ...
Adriano Bittar's user avatar
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 ...
Kasluk24's user avatar
  • 131
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-...
Andrea Giudiceandrea's user avatar
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 ...
Comrade Che's user avatar
  • 7,476
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
Jacob's user avatar
  • 1
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=&...
Bera's user avatar
  • 76.2k

Top 50 recent answers are included