Re: [Qgis-user] Python code to select polygon at location - SOLVED

2024-08-25 Thread Zoltan Szecsei via QGIS-User
Hi, Just by way of finality: The CRS of the polygon SHP was not what it was purported to be. I found that the .prj file was invalid when opening it in QGIS - maybe next time I will first look at the maps I am given, rather than just dive into python scripting. All working as expected, now. T

Re: [Qgis-user] Python code to select polygon at location

2024-08-25 Thread Zoltan Szecsei via QGIS-User
So as updated plan-of-attack as below. lyr_poly = QgsVectorLayer(poly_shp, '', 'Ogr') lyr_poly_si = QgsSpatialIndex(lyr_poly.getFeatures(), flags=QgsSpatialIndex.FlagStoreFeatureGeometries) # EPSG:4326 point = QgsPointXY(lon, lat) point_rect = QgsGeometry.fromPointXY(point).

Re: [Qgis-user] Python code to select polygon at location

2024-08-25 Thread Zoltan Szecsei via QGIS-User
Ah - bad explanation on my part. [apologies] I have the coordinates from a spreadsheet and I am busy making the Point SHP (but wanting some attribute values from underlying polygons) On 2024/08/25 18:47, oisin.kelly.wild--- via QGIS-User wrote: For the point layer create a calculated field usi

Re: [Qgis-user] Python code to select polygon at location

2024-08-25 Thread Zoltan Szecsei via QGIS-User
It's part of a much longer python script doing a bunch of other stuff, so to now change the flow to incorporate postgis is not really an option. (but thanks) On 2024/08/25 18:07, Greg Troxel via QGIS-User wrote: Zoltan Szecsei via QGIS-User writes: Hi, I'm doing my "once a year need to do s

Re: [Qgis-user] Python code to select polygon at location

2024-08-25 Thread oisin.kelly.wild--- via QGIS-User
For the point layer create a calculated field using overlay_within() function. ⁣Oisin 07570 977449 Get BlueMail for Android ​ On 25 Aug 2024, 16:07, at 16:07, Greg Troxel via QGIS-User wrote: >Zoltan Szecsei via QGIS-User writes: > >> Hi, >> I'm doing my "once a year need to do something in p

Re: [Qgis-user] Python code to select polygon at location

2024-08-25 Thread Greg Troxel via QGIS-User
Zoltan Szecsei via QGIS-User writes: > Hi, > I'm doing my "once a year need to do something in python with QGIS" :-/ > Using QGIS 3.38 and PyCharm. > > I have a SHP file with 28000 polygons. > Another SHP file with 22000 Points > Both in EPSG:4326 > > Without using QGIS processing, what is the qu

[Qgis-user] Python code to select polygon at location

2024-08-25 Thread Zoltan Szecsei via QGIS-User
Hi, I'm doing my "once a year need to do something in python with QGIS" :-/ Using QGIS 3.38 and PyCharm. I have a SHP file with 28000 polygons. Another SHP file with 22000 Points Both in EPSG:4326 Without using QGIS processing, what is the quickest way to, for each point 1 by 1, find the underl