3

I would like to use SQL to create a virtual layer in QGIS by clipping information from a large data set using a bounding box around my study area.

Diagram of GUI Feedback

I have two questions. Is this an efficient way to work with large data sets (i.e., more efficient than just loading a large shapefile)?

How do I write the query? for it? I don't really know what I am doing, so far my query looks like this:

Select F* Where ST_Intersects(F.geometry,C.geometry)

At the moment, I keep crashing my computer with my queries. I will post back if I figure this out.

1 Answer 1

6

A sample syntax for you.

SELECT *
FROM F, C
WHERE st_within(F.geometry, C.geometry) = 1

On a side note:

  • SELECT * will output everything (including geometry column) fits your conditions.
  • FROM F,C will define the datasource
  • WHERE is the condition, and st_intersects() requires 1 (TRUE) or 0 (FALSE). I chose st_within() for your case.

I hope testing this and comparing the speed with other methods answers your first question, too.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.