1

I have two layers, one is a grid of circles and the other is all Census Block Groups (CBG) in the state of Florida. I created a Virtual Layer out of this code

SELECT CirclesFlorida.name, group_concat(cbgFl.FIPS)
FROM CirclesFlorida
LEFT JOIN cbgFl ON ST_Intersects(circlesFlorida.geometry, cbgFl.geometry)
GROUP BY circlesflorida.name

The purpose is for each circle to have a data column which lists every CBG that falls in that circle.

Is there a faster way to do this? Maybe DB Manager? Currently the query takes 20 minutes to run and another 5 minutes to just open the attribute table of the Virtual Layer.

Taras
35.8k5 gold badges77 silver badges152 bronze badges
asked Sep 28, 2020 at 22:03
7
  • the db manager sql interface will use a sqlite database on the back-end to do the processing... I would try it out. I don't know if the sql layer is doing the same. Commented Sep 28, 2020 at 22:16
  • As an alternative try to construct a model in the Graphical Modeler, it can also work with SQL queries, see this gis.stackexchange.com/a/360796/99589. Commented Sep 29, 2020 at 5:22
  • Otherwise you may try running the Virtual Layer via Python console, check this gis.stackexchange.com/questions/227203/… Commented Sep 29, 2020 at 5:37
  • @DPSSpatial the sqlite doesn't recognize the ".geometry" attribute as a column. Is it written in a different kind of SQL? How would I write it? Commented Sep 29, 2020 at 8:05
  • 1
    Try to use _searchframe_ in your query! This helped me: lists.osgeo.org/pipermail/qgis-developer/2021-May/063582.html Commented Oct 3, 2023 at 10:55

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.