New answers tagged

1

You may also use "fix geometry" tool in the QGIS toolbox and it should works properly


2

What the problem was: duplicate points After inspecting your data, I could identify the problem: you have a lot of duplicate points as well as a few points that are "almost" duplicates (extremely close to each other). From originally 954 features in the point layer you provided, only 229 (ca. 24%) are really unique points (thus not duplicates or ...


10

I'll answer my own question but credit goes to user30184 for giving me a couple clues. The problem seems to be that the first few thousand rows in my table are LineStrings and apparently QGIS isn't examining all of the rows and finding the other geometry types in the table. The solution, at least in QGIS 3.18.2, is to check the "Don't resolve type of ...


10

I guess you want to move a box' centroid position to another point if it has a common attribute with the point. I assume ID_PARENT and CODE are unique values. Use this script: box_layer = QgsProject.instance().mapLayersByName('box')[0] point_layer = QgsProject.instance().mapLayersByName('point')[0] dpr = box_layer.dataProvider() for box in box_layer....


5

Perhaps the only thing that you need to do is to refresh the connection by pressing the Connect button again. This was my test case: CREATE TABLE geometrytest (id integer, geom geometry(MultiLineString)); INSERT INTO geometrytest values (1,ST_GeomFromText('MultiLineString ((0 0,3 3))')); ALTER TABLE geometrytest ALTER COLUMN geom type geometry(Geometry); ...


1

What spatial predicates are you using in the SpatialRelator transformer? If it's Within-Supplier or Contains-Supplier then I would think a point on the exact boundary wouldn't match. But if you also turn on Intersects-Supplier or Touches-Supplier then it would also get that point as a match. The other possibility is that it really doesn't fall inside, but ...


1

I'm sure someone else can come up with a more elegant solution using PostGIS or python, but here's something I cobbled up using regular tools that should work if you're only concerned with a few river polygons. I hope I understood the size you want your resulting polygon relative to the original: v.voronoi.skeleton to find centerlines clean up the "...


1

I need to do something similar, but I don't seem to find the Euclidean distance tool. I have a polygon which represents a riverbed area and I would like to make a buffer based on the river width. So I am wondering if the proposed procedure is suited to achieve what I am trying to do. The buffer would be n*width with n an integer number I choose. If you look ...


0

And here is @xunilk's code translated to QGIS 3.* from osgeo import gdal from PyQt5.QtCore import * from qgis.analysis import QgsRasterCalculator, QgsRasterCalculatorEntry from qgis.core import QgsVectorLayer, QgsField, QgsFeature, QgsGeometry, QgsPoint #read CRS as EPSG from the raster file: myCRS = iface.activeLayer().crs().authid() #read Raster path: ...


0

'LineString' object has no attribute 'lenght' You might want to try length, not lenght.


0

L.GeometryUtil.closest function has 4 parameters: (map: L.Map, array: Array.<L.LatLng> | Array.<Array.<L.LatLng>> | L.PolyLine | L.Polygon, latlng: L.LatLng, vertices: Boolean). The last parameter restricts output to a vertex in the given array of coordinates. This is what you are looking for. More: https://makinacorpus.github.io/Leaflet....


2

You can use QGIS expressions with Geometry Generator or Geometry by expression for this - see here for details about these two options. In both cases, simply use this expression: close_line( $geometry). Screenshot: Blue=original line; red=line created with the above expression:


4

The object is stored as a single ring, so there's no indication of where the break is. You will have to take that @coords matrix, figure out which are the outer coordinates and which are the hole, then reassemble the parts into two rings. If you can install QGIS (free, open source GIS) then there's graphical ways to select vertices of polygons and create new ...


6

The problem is that you expect that make_ellipse returns an ellipse in EPSG:26913 coordinates. Yes, it returns EPSG:26913 coordinates (big numbers like 500000 which are projected coordinates), but QGIS considers those are in source layer's CRS, EPSG:4269 (lat, long). If you check the CRS of ellipses_out, you will see its CRS is EPSG:4269. For a solution, use ...


0

So, apparently insertCursor demands a list object. With the following, the code works. I'll leave it here for posterity; if mods want to remove the question in case they find it too basic, that's fine too. def get_extent_centroid(layer): desc = arcpy.Describe(layer) if desc.dataType in ['FeatureLayer', 'RasterLayer']: extent = desc.extent array = ...


Top 50 recent answers are included