13 votes
Accepted

Deleting small holes in polygons with PostGIS

This is one of those processes which are simple in an iterative language, but trickier in set-oriented SQL. But the ST_DumpX set-returning functions in PostGIS and the array handling in Postgres make ...
user avatar
  • 3,621
7 votes

Deleting small holes in polygons with PostGIS

Just to add a little less convoluted solution in SQL, shifting construction logic to ST_BuildArea - the LATERAL join predicate is an elegant method to expand and iterate over sets of rows returned ...
user avatar
  • 23.3k
5 votes

Finding change between two sets of polygon data in QGIS

Run Menu Processing > Toolbox > Geometry by expression with this expression with Input Layer the polygon layer representing the boundaries in 2020. In the expression at the end of line 2, ...
user avatar
  • 40.1k
3 votes

Deleting small holes in polygons with PostGIS

Based on dr_jts response, I propose the following version of the design and name of the new spatial SQL function: Create a spatial custom SQL function: CREATE OR REPLACE FUNCTION ...
user avatar
3 votes

Deleting small holes in polygons with PostGIS

Based on your example, just extract the interior ring of your geom, calculate it's area and use it as condition in where clause as: SELECT gid, ST_Collect(ST_MakePolygon(geom)) As geom FROM ( ...
user avatar
  • 423
2 votes

"Has no attribute geometry" error when creating polygon with Shapely

I have seen your previous question, where I would like to extend @KadirŞahbaz's answer: from shapely.geometry import Polygon ... for steps in range(numVertices): pt = geom.vertexAt(steps) ...
user avatar
  • 23k
1 vote
Accepted

Set point geometry of a list of points in PYQGIS

You need to define a Coordinate Reference System for your layer. You can do this when you define your QgsVectorLayer object like this: vl = QgsVectorLayer('Point?crs=EPSG:3857', 'Error_point', 'memory'...
user avatar
  • 13.6k
1 vote

How do you flip/invert/reverse the order of the coordinates of shapely geometries?

The substring operation in Shapely can be used for this. From the substring docs: If the start distance is actually past the end distance, then the reversed substring is returned such that the start ...
user avatar
  • 221
1 vote

Updating feature geometry from attribute fields in QGIS

Another option is to use the make_point() function together with updated fields "x" and "y". before change : window : after change :
user avatar
  • 23k
1 vote

Filter by bounding box in GeoPandas

A quick solution to this if the shape you want to clip by is a box: from shapely.geometry import box bbox = box(*df_sussex.total_bounds) df_clipped = gpd.mask(df, mask=bbox) It uses the shapely....
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible