New answers tagged


It has been answered here and here. You need to first add the layer to map even if you don't display it before removing it. QgsProject.instance().addMapLayer(vlayer, False) QgsProject.instance().removeMapLayer( os.remove(vlayer.source()) It usually works, but I recently had an issue with FLT files (raster format) which seems to stick whatever I ...


The .area in shapely is plane area, so we need to transform longitude, latitude (4326) to project spatial reference (e.g. 3857). For rectangle, if the original size is a * b, area is A, buffer distance is X, the buffer area B then: B = A + 2 * (a + b) * X + pi * X * X ----- (1) 2 * (a + b) = c = perimeter = poly_B.length (1) => X = sqrt(c * c - 4 * (...


Thanks for the comments! Turns out my shapefile was corrupted. I downloaded the data from the link that user2856 provided me and it works now. Really appreciate it. I spent way too long on it. Should have thought of that..


On Linux/Ubuntu, I needed to do something similar today and came up with the following solution. It uses a few helper utilities that were already in my Ubuntu shell, but it's an effective one-liner that doesn't require creating any VRT sidecar, etc. It's a handy way to solve "I have some WKT features and I want a shapefile" without having to open ...

Top 50 recent answers are included