New answers tagged

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
0 votes
Accepted

Clip lower value polygons with larger value polygons in shapefile

I had to do something like this a long time ago, here is the repo and a description. https://github.com/debboutr/overlapTopoTool If you identify the column you want to use as the weight on line 84 of ...
user avatar
  • 487
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
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
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
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
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
0 votes

Invalid geometry in QGIS vs ArcGIS

It could be that those programs on your machine are set with different defaults for rounding decimals. If one rounds to the 7th decimal and one to the 8th decimal then you may have occasions where ...
user avatar
0 votes

What are Definition, Algorithms and Practical Solutions for Concave Hull?

JTS now has a Concave Hull implementation. This is based on erosion of the Delaunay triangulation of the input points. It supports creating holes, and provides both absolute and scale-free length ...
user avatar
  • 3,621
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
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

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
0 votes

MMQGIS export shapefile to KML not working, error message: 'Unknown geometry type 0'. But Point data being used?

Before you will use the KML export by the MMQGIS plugin you should reproject your layer. The quickest way to do it is using the "Reproject layer" option in your processing toolbox. As the ...
user avatar
  • 3,546
2 votes
Accepted

Retrieve polygon smallest MBR

Some 11 years late to the party, but I think this does what you want (well, from v2.5.0 which was probably after you asked!) https://postgis.net/docs/ST_OrientedEnvelope.html
user avatar
  • 36

Top 50 recent answers are included