Skip to main content

Timeline for Filtering OSM natural peaks in QGIS

Current License: CC BY-SA 4.0

20 events
when toggle format what by license comment
Jun 23, 2021 at 15:54 comment added Babel You're welcome. Don't confuse distance tool on the map canvas and the distances used to calculate distances for each layer! Also don't confuse planimetric (cartesian) and ellipsoidal distances. That's why you get different distances.
Jun 23, 2021 at 15:50 vote accept Nebojsa
Jun 23, 2021 at 15:49 comment added Nebojsa It seems that this is exactly the problem (although the distance tool gets distances right). In any case, your answer covers everything in case someone else finds themselves in a similar situation. My problem is solved by choosing a very small distance as a workaround, but does exactly what I need. Thank you for the help, I learned a lot from this!
Jun 23, 2021 at 9:35 history edited Babel CC BY-SA 4.0
deleted 10 characters in body
Jun 23, 2021 at 7:28 history edited Babel CC BY-SA 4.0
added 49 characters in body
Jun 23, 2021 at 7:12 comment added Babel Your peak-layer from OpenStreetMap is probably still in EPSG:4326, isn't it? You changed the project CRS, but not the layer CRS to EPSG:32634. That would explain why changing the max_distance has no effect. Be sure to properly understand the difference between layer and project CRS, see: gis.stackexchange.com/a/392388/88814
Jun 23, 2021 at 5:21 comment added Babel OK, so I guess best would be if you could provide your data (+ your project file, if possible). It's difficult to see what went wrong in your case using my own project and data - in my case, everything works fine. So there must be some setting, but from far, it's difficult to guess.
Jun 22, 2021 at 23:25 comment added Nebojsa Unmarked as accepted answer. I feel we are on the right track but in the current form, this solution still doesn't solve the issue.
Jun 22, 2021 at 22:51 comment added Nebojsa What I did so far: - I used the Field Calculator to add a field called ele_int, and I used the expression to_int(to_real(ele)) to populate it - Then I tried selecting by array_max of overlay_nearest on ele_int instead of ele and I still can't get it to work. I'll update my question with more details. Thank you for helping :)
Jun 22, 2021 at 12:30 comment added Babel OK, I now see the problem: when you download OpenStreetMap data, you have a field ele for elevation. It is, however, formatted as string (text), not as number, so that's why it doesn't work. You have to convert the values to a integer format first. You could do it directly in the expression, however I would recomand creating a new attribute elevation with field calculator because you also have empty values that can create problems. I updated my answer accordingly.
Jun 22, 2021 at 12:30 history edited Babel CC BY-SA 4.0
added 509 characters in body
Jun 22, 2021 at 11:32 comment added Nebojsa For what it's worth, I get the same results with QGIS 3.16. The number of selected points doesn't change when changing max_distance. array_last ( array_sort( overlay_nearest( @layer, expression:=ele, max_distance:=5000, limit:=100 ) ) )> ele
Jun 22, 2021 at 10:37 comment added Nebojsa I used QGIS 3.20, and the data I use can be reproduced by importing openstreetmap data using the natural=peak query. To that data, I apply the select by expression, and I do not use array_max but instead the array_last and array_sort sequence. I'm now going to check with 3.16 LTR.
Jun 22, 2021 at 10:31 comment added Babel Can you provide sample data? Which QGIS version do you use? Be sure to have 3.16 or later - and if you use the version with array_max, you must have 3.18 or later. When I test it, the result changes with different values for max_distance.
Jun 22, 2021 at 10:24 comment added Nebojsa I do have a problem with this kind of query - it works the same regardless if I set max_distance to 1 or 100000. Changing the limit does work and give different results. The map unit is set to meters. @Babel do you have any idea why? I updated to QGIS 3.20 in the meantime.
Jun 22, 2021 at 8:13 comment added Nebojsa Thank you, I wasn't aware of the "select by expression" feature, nor was I familiar with the scripting language. This answer worked for me.
Jun 22, 2021 at 8:12 vote accept Nebojsa
Jun 22, 2021 at 23:24
Jun 21, 2021 at 17:51 history edited Babel CC BY-SA 4.0
added 339 characters in body
Jun 21, 2021 at 16:54 history edited Babel CC BY-SA 4.0
added 550 characters in body
Jun 21, 2021 at 16:45 history answered Babel CC BY-SA 4.0