I have QGIS 2.8.2 Wien on windows 7 and quite new to QGIS. I have two shapefiles - 1 with rivers and 2 with sites located on some of those rivers. I want to carry out a spatial query to find the river sections that have sites located on them, but when I carry out the query, no sections are found, although there should be over 100 of them. I have checked that the CRS is the same on both layers (EPSG:29903 TM75 Irish grid), I don't know why results don't show up.
Asked
Active
Viewed 789 times
3
-
Perhaps this recent post might help in terms of a spatial query? – Joseph Jan 08 '16 at 13:00
-
Thank you Joseph appreciate your post suggestion, unfortunately doesn't solve my problem, no idea why spatial query reveals no results as I following exact procedure as tutorial found http://www.qgistutorials.com/en/docs/performing_spatial_queries.html – lynda Jan 08 '16 at 13:15
-
Most welcome! Have you tried using the Select by location tools? – Joseph Jan 08 '16 at 13:16
-
No I haven't used those tools before, if you think they might do the job I will look in to them, cheers – lynda Jan 08 '16 at 13:21
-
2Can you share data or at least screenshots? There's not enough info to find the problem here. – underdark Jan 10 '16 at 00:27
-
Thanks Underdark, not sure how to upload pictures to show you but I have a shape layer of all the rivers in Ireland sourced from Environmental Protection agency, I have my own layer of sampling sites on some of these rivers (as points). I want to select the segments of rivers that have my sampling sites as there is info on the river layer such as gradient etc I need for each of my sites. Thanks to Raphael I have detected 14 errors (see post below) maybe this is why the spatial query or Ed's select by location is not working – lynda Jan 11 '16 at 08:41
-
can you post the shapefiles (rivers & your points) on a cloud site somewhere I could look at it too? – ed.hank Feb 04 '16 at 23:58
2 Answers
2
Use Processing toolbox > select by location and choose intersects and choose a precision of 50 meters (or whatever buffer you think is appropriate.) Alternatively you could buffer the rivers with a 50m buffer (again or whatever is appropriate) then do a select by location of the points to the polygons and this time select within instead of intersects. This will select all points of interest that are on or near the river. Then export these set of points out and you are ready to go.
ed.hank
- 3,862
- 1
- 14
- 35
1
Maybe some geometries are not valid, can you check their validity with "Check Geometry Validity" Tool ?
If it's a validy problem, you can then fix them : Fixing geometry validity errors in QGIS?
-
Thank you all, very grateful for your suggestions, Yes Raphael I have 14 errors detected on the river layer. I'm sorry but I am new to QGIS and find the fixing in GRASS etc. hard to understand, is there a simple manual way I can fix these in QGIS? and are these errors the cause of spatial query not working? – lynda Jan 11 '16 at 08:28
-
Example of some of the errors: 16215,segments 37 and 39 of line 0 intersect at 161866.533227, 286650.581012 16215,Geometry has 1 errors. 18074,segments 17 and 19 of line 0 intersect at 180284.317251, 232181.656127 18074,Geometry has 1 errors. 37154,segments 12 and 14 of line 0 intersect at 168131.471373, 111254.379391 37154,Geometry has 1 errors. 39706,segments 12 and 14 of line 0 intersect at 236985.547856, 140262.754145 39706,Geometry has 1 errors. 50076,segments 10 and 12 of line 0 intersect at 300931.699705, 115366.440032 50076,Geometry has 1 errors. – lynda Jan 11 '16 at 08:30