Virtual layer functionality does not seem to support memory layersSpatial join for closest features and using a sum merge rule in QGISMemory Vector Layer Corrupted?Is it possible to use memory layers in QGIS processing algorithms?QGIS python originalName() does not return actual original layer nameVirtual fields are lost when duplicate layersQGIS virtual layer path never saved as relativeClipping virtual raster generates out of memory errorLoad non-spatial table in QGIS by querying an Oracle databaseAdd layer to existing geopackage not working in QGIS?Virtual layer from query with special characters in field name using PyQGISSpatial Query for a Virtual Layer

Minor Revision with suggestion of an alternative proof by reviewer

Does a large simulator bay have standard public address announcements?

Why do games have consumables?

What is the most expensive material in the world that could be used to create Pun-Pun's lute?

How much cash can I safely carry into the USA and avoid civil forfeiture?

Function pointer with named arguments?

What happened to Captain America in Endgame?

How to fry ground beef so it is well-browned

Like totally amazing interchangeable sister outfits II: The Revenge

Who was the lone kid in the line of people at the lake at the end of Avengers: Endgame?

"You've called the wrong number" or "You called the wrong number"

Why does Mind Blank stop the Feeblemind spell?

Why did C use the -> operator instead of reusing the . operator?

a sore throat vs a strep throat vs strep throat

Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?

Converting a sprinkler system's 24V AC outputs to 3.3V DC logic inputs

How can I practically buy stocks?

Why does nature favour the Laplacian?

Rivers without rain

Implications of cigar-shaped bodies having rings?

Alignment of various blocks in tikz

What does the integral of a function times a function of a random variable represent, conceptually?

Does tea made with boiling water cool faster than tea made with boiled (but still hot) water?

Is Diceware more secure than a long passphrase?



Virtual layer functionality does not seem to support memory layers


Spatial join for closest features and using a sum merge rule in QGISMemory Vector Layer Corrupted?Is it possible to use memory layers in QGIS processing algorithms?QGIS python originalName() does not return actual original layer nameVirtual fields are lost when duplicate layersQGIS virtual layer path never saved as relativeClipping virtual raster generates out of memory errorLoad non-spatial table in QGIS by querying an Oracle databaseAdd layer to existing geopackage not working in QGIS?Virtual layer from query with special characters in field name using PyQGISSpatial Query for a Virtual Layer






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I have a memory layer loaded in the QGIS virtual layer in the data source manager. I am trying to run a very simple query:



select * from layer


Here is a snapshot:
enter image description here



While this works for the physical layer, it does not work for the memory layer. They output virtual layer is blank, and I know that my memory layer has attribute data.



Is this simply a bug? I want to keep this a memory layer to reduce the number of steps I need to do to arrive at my final result. Should I resort to another tool or is there a workaround?



EDIT



Also found this quote in this link:




Creating a virtual layer with the layer_ref key allows to directly access already loaded QGIS layers (including memory layers).











share|improve this question



















  • 1





    Just tested right now : i had no problem of this kind (Q3.44) ... Are you sure of your data structure ?

    – snaileater
    Apr 19 at 9:28







  • 1





    what do you mean by data structure? I am just calling all columns in the table I loaded.... Using QGIS3.2.2 by the way

    – user32882
    Apr 19 at 9:29






  • 1





    When u open its attribute table in the layer manager you see all the features (those u would like to get when querying it) ? Do u just get an empty answer or any error message ? Did u try a select count(*) from memory_layer ?

    – snaileater
    Apr 19 at 9:33







  • 1





    The resulting virtual layer is empty (no attributes, no fields). The original memory layer has plenty of attributes... I'm updating QGIS now to see if it has been fixed

    – user32882
    Apr 19 at 9:36






  • 1





    Nope... doesn't work with QGIS 3.4.6... Are you sure you tested a memory layer?

    – user32882
    Apr 19 at 9:43

















3















I have a memory layer loaded in the QGIS virtual layer in the data source manager. I am trying to run a very simple query:



select * from layer


Here is a snapshot:
enter image description here



While this works for the physical layer, it does not work for the memory layer. They output virtual layer is blank, and I know that my memory layer has attribute data.



Is this simply a bug? I want to keep this a memory layer to reduce the number of steps I need to do to arrive at my final result. Should I resort to another tool or is there a workaround?



EDIT



Also found this quote in this link:




Creating a virtual layer with the layer_ref key allows to directly access already loaded QGIS layers (including memory layers).











share|improve this question



















  • 1





    Just tested right now : i had no problem of this kind (Q3.44) ... Are you sure of your data structure ?

    – snaileater
    Apr 19 at 9:28







  • 1





    what do you mean by data structure? I am just calling all columns in the table I loaded.... Using QGIS3.2.2 by the way

    – user32882
    Apr 19 at 9:29






  • 1





    When u open its attribute table in the layer manager you see all the features (those u would like to get when querying it) ? Do u just get an empty answer or any error message ? Did u try a select count(*) from memory_layer ?

    – snaileater
    Apr 19 at 9:33







  • 1





    The resulting virtual layer is empty (no attributes, no fields). The original memory layer has plenty of attributes... I'm updating QGIS now to see if it has been fixed

    – user32882
    Apr 19 at 9:36






  • 1





    Nope... doesn't work with QGIS 3.4.6... Are you sure you tested a memory layer?

    – user32882
    Apr 19 at 9:43













3












3








3








I have a memory layer loaded in the QGIS virtual layer in the data source manager. I am trying to run a very simple query:



select * from layer


Here is a snapshot:
enter image description here



While this works for the physical layer, it does not work for the memory layer. They output virtual layer is blank, and I know that my memory layer has attribute data.



Is this simply a bug? I want to keep this a memory layer to reduce the number of steps I need to do to arrive at my final result. Should I resort to another tool or is there a workaround?



EDIT



Also found this quote in this link:




Creating a virtual layer with the layer_ref key allows to directly access already loaded QGIS layers (including memory layers).











share|improve this question
















I have a memory layer loaded in the QGIS virtual layer in the data source manager. I am trying to run a very simple query:



select * from layer


Here is a snapshot:
enter image description here



While this works for the physical layer, it does not work for the memory layer. They output virtual layer is blank, and I know that my memory layer has attribute data.



Is this simply a bug? I want to keep this a memory layer to reduce the number of steps I need to do to arrive at my final result. Should I resort to another tool or is there a workaround?



EDIT



Also found this quote in this link:




Creating a virtual layer with the layer_ref key allows to directly access already loaded QGIS layers (including memory layers).








qgis virtual-layer






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 20 at 12:52









underdark

69.4k13179351




69.4k13179351










asked Apr 19 at 9:12









user32882user32882

1,17611127




1,17611127







  • 1





    Just tested right now : i had no problem of this kind (Q3.44) ... Are you sure of your data structure ?

    – snaileater
    Apr 19 at 9:28







  • 1





    what do you mean by data structure? I am just calling all columns in the table I loaded.... Using QGIS3.2.2 by the way

    – user32882
    Apr 19 at 9:29






  • 1





    When u open its attribute table in the layer manager you see all the features (those u would like to get when querying it) ? Do u just get an empty answer or any error message ? Did u try a select count(*) from memory_layer ?

    – snaileater
    Apr 19 at 9:33







  • 1





    The resulting virtual layer is empty (no attributes, no fields). The original memory layer has plenty of attributes... I'm updating QGIS now to see if it has been fixed

    – user32882
    Apr 19 at 9:36






  • 1





    Nope... doesn't work with QGIS 3.4.6... Are you sure you tested a memory layer?

    – user32882
    Apr 19 at 9:43












  • 1





    Just tested right now : i had no problem of this kind (Q3.44) ... Are you sure of your data structure ?

    – snaileater
    Apr 19 at 9:28







  • 1





    what do you mean by data structure? I am just calling all columns in the table I loaded.... Using QGIS3.2.2 by the way

    – user32882
    Apr 19 at 9:29






  • 1





    When u open its attribute table in the layer manager you see all the features (those u would like to get when querying it) ? Do u just get an empty answer or any error message ? Did u try a select count(*) from memory_layer ?

    – snaileater
    Apr 19 at 9:33







  • 1





    The resulting virtual layer is empty (no attributes, no fields). The original memory layer has plenty of attributes... I'm updating QGIS now to see if it has been fixed

    – user32882
    Apr 19 at 9:36






  • 1





    Nope... doesn't work with QGIS 3.4.6... Are you sure you tested a memory layer?

    – user32882
    Apr 19 at 9:43







1




1





Just tested right now : i had no problem of this kind (Q3.44) ... Are you sure of your data structure ?

– snaileater
Apr 19 at 9:28






Just tested right now : i had no problem of this kind (Q3.44) ... Are you sure of your data structure ?

– snaileater
Apr 19 at 9:28





1




1





what do you mean by data structure? I am just calling all columns in the table I loaded.... Using QGIS3.2.2 by the way

– user32882
Apr 19 at 9:29





what do you mean by data structure? I am just calling all columns in the table I loaded.... Using QGIS3.2.2 by the way

– user32882
Apr 19 at 9:29




1




1





When u open its attribute table in the layer manager you see all the features (those u would like to get when querying it) ? Do u just get an empty answer or any error message ? Did u try a select count(*) from memory_layer ?

– snaileater
Apr 19 at 9:33






When u open its attribute table in the layer manager you see all the features (those u would like to get when querying it) ? Do u just get an empty answer or any error message ? Did u try a select count(*) from memory_layer ?

– snaileater
Apr 19 at 9:33





1




1





The resulting virtual layer is empty (no attributes, no fields). The original memory layer has plenty of attributes... I'm updating QGIS now to see if it has been fixed

– user32882
Apr 19 at 9:36





The resulting virtual layer is empty (no attributes, no fields). The original memory layer has plenty of attributes... I'm updating QGIS now to see if it has been fixed

– user32882
Apr 19 at 9:36




1




1





Nope... doesn't work with QGIS 3.4.6... Are you sure you tested a memory layer?

– user32882
Apr 19 at 9:43





Nope... doesn't work with QGIS 3.4.6... Are you sure you tested a memory layer?

– user32882
Apr 19 at 9:43










2 Answers
2






active

oldest

votes


















2














You can find all your layers in the DB-manager. There (in my opinion) it is easier to access and query them. And you can load results as a new layer.



  • Go to DB-manager > Virtual Layers > QGIS layers


  • Select one of the layers and make your query. Note that the geometry is written as geometry and not geom.


enter image description here






share|improve this answer

























  • The DB Manager is much better and could be a good segway into PostGIS, spatialite or other db-type gis systems. Do you know if the geometry column can be manipulated in here to do spatial queries as well? Perhaps I don't need that NNJoin plugin after all.... that would be nice

    – user32882
    Apr 19 at 13:10











  • I never used the NNjoin before. So I do not know which functionality it has. But probably it would perform the same with spatialite or postgis

    – PieterB
    Apr 23 at 7:31











  • To answer your question @user32882 you can easily perform spatial joins and nearest neighbour queries in DB Manager using SQL. It may not be that fast if you are using shapefiles in DB manager, but it is dynamic and much more flexible (pick which columns to join, distance threshold for nearest neighbour, etc). If you use spatialite you can access the VirtualKNN feature directly within DB Manager. SQL is well worth exploring

    – she_weeds
    14 hours ago


















3














The upper section, embeded layers, allows listing (and using) layers that are not loaded in QGIS table of content.



Using an in-memory layer that is not loaded in QGIS is to be tested. I believe the layer is cleared from memory as soon as it is removed from the table of content.



If you do have the in-memory layer loaded in the table of content, you can simply remove it from the embeded layers section, and the query will work. I just reproduced your use case and workaround in 3.4.5






share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "79"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f319324%2fvirtual-layer-functionality-does-not-seem-to-support-memory-layers%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    You can find all your layers in the DB-manager. There (in my opinion) it is easier to access and query them. And you can load results as a new layer.



    • Go to DB-manager > Virtual Layers > QGIS layers


    • Select one of the layers and make your query. Note that the geometry is written as geometry and not geom.


    enter image description here






    share|improve this answer

























    • The DB Manager is much better and could be a good segway into PostGIS, spatialite or other db-type gis systems. Do you know if the geometry column can be manipulated in here to do spatial queries as well? Perhaps I don't need that NNJoin plugin after all.... that would be nice

      – user32882
      Apr 19 at 13:10











    • I never used the NNjoin before. So I do not know which functionality it has. But probably it would perform the same with spatialite or postgis

      – PieterB
      Apr 23 at 7:31











    • To answer your question @user32882 you can easily perform spatial joins and nearest neighbour queries in DB Manager using SQL. It may not be that fast if you are using shapefiles in DB manager, but it is dynamic and much more flexible (pick which columns to join, distance threshold for nearest neighbour, etc). If you use spatialite you can access the VirtualKNN feature directly within DB Manager. SQL is well worth exploring

      – she_weeds
      14 hours ago















    2














    You can find all your layers in the DB-manager. There (in my opinion) it is easier to access and query them. And you can load results as a new layer.



    • Go to DB-manager > Virtual Layers > QGIS layers


    • Select one of the layers and make your query. Note that the geometry is written as geometry and not geom.


    enter image description here






    share|improve this answer

























    • The DB Manager is much better and could be a good segway into PostGIS, spatialite or other db-type gis systems. Do you know if the geometry column can be manipulated in here to do spatial queries as well? Perhaps I don't need that NNJoin plugin after all.... that would be nice

      – user32882
      Apr 19 at 13:10











    • I never used the NNjoin before. So I do not know which functionality it has. But probably it would perform the same with spatialite or postgis

      – PieterB
      Apr 23 at 7:31











    • To answer your question @user32882 you can easily perform spatial joins and nearest neighbour queries in DB Manager using SQL. It may not be that fast if you are using shapefiles in DB manager, but it is dynamic and much more flexible (pick which columns to join, distance threshold for nearest neighbour, etc). If you use spatialite you can access the VirtualKNN feature directly within DB Manager. SQL is well worth exploring

      – she_weeds
      14 hours ago













    2












    2








    2







    You can find all your layers in the DB-manager. There (in my opinion) it is easier to access and query them. And you can load results as a new layer.



    • Go to DB-manager > Virtual Layers > QGIS layers


    • Select one of the layers and make your query. Note that the geometry is written as geometry and not geom.


    enter image description here






    share|improve this answer















    You can find all your layers in the DB-manager. There (in my opinion) it is easier to access and query them. And you can load results as a new layer.



    • Go to DB-manager > Virtual Layers > QGIS layers


    • Select one of the layers and make your query. Note that the geometry is written as geometry and not geom.


    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 19 at 11:33

























    answered Apr 19 at 11:01









    PieterBPieterB

    3,2001129




    3,2001129












    • The DB Manager is much better and could be a good segway into PostGIS, spatialite or other db-type gis systems. Do you know if the geometry column can be manipulated in here to do spatial queries as well? Perhaps I don't need that NNJoin plugin after all.... that would be nice

      – user32882
      Apr 19 at 13:10











    • I never used the NNjoin before. So I do not know which functionality it has. But probably it would perform the same with spatialite or postgis

      – PieterB
      Apr 23 at 7:31











    • To answer your question @user32882 you can easily perform spatial joins and nearest neighbour queries in DB Manager using SQL. It may not be that fast if you are using shapefiles in DB manager, but it is dynamic and much more flexible (pick which columns to join, distance threshold for nearest neighbour, etc). If you use spatialite you can access the VirtualKNN feature directly within DB Manager. SQL is well worth exploring

      – she_weeds
      14 hours ago

















    • The DB Manager is much better and could be a good segway into PostGIS, spatialite or other db-type gis systems. Do you know if the geometry column can be manipulated in here to do spatial queries as well? Perhaps I don't need that NNJoin plugin after all.... that would be nice

      – user32882
      Apr 19 at 13:10











    • I never used the NNjoin before. So I do not know which functionality it has. But probably it would perform the same with spatialite or postgis

      – PieterB
      Apr 23 at 7:31











    • To answer your question @user32882 you can easily perform spatial joins and nearest neighbour queries in DB Manager using SQL. It may not be that fast if you are using shapefiles in DB manager, but it is dynamic and much more flexible (pick which columns to join, distance threshold for nearest neighbour, etc). If you use spatialite you can access the VirtualKNN feature directly within DB Manager. SQL is well worth exploring

      – she_weeds
      14 hours ago
















    The DB Manager is much better and could be a good segway into PostGIS, spatialite or other db-type gis systems. Do you know if the geometry column can be manipulated in here to do spatial queries as well? Perhaps I don't need that NNJoin plugin after all.... that would be nice

    – user32882
    Apr 19 at 13:10





    The DB Manager is much better and could be a good segway into PostGIS, spatialite or other db-type gis systems. Do you know if the geometry column can be manipulated in here to do spatial queries as well? Perhaps I don't need that NNJoin plugin after all.... that would be nice

    – user32882
    Apr 19 at 13:10













    I never used the NNjoin before. So I do not know which functionality it has. But probably it would perform the same with spatialite or postgis

    – PieterB
    Apr 23 at 7:31





    I never used the NNjoin before. So I do not know which functionality it has. But probably it would perform the same with spatialite or postgis

    – PieterB
    Apr 23 at 7:31













    To answer your question @user32882 you can easily perform spatial joins and nearest neighbour queries in DB Manager using SQL. It may not be that fast if you are using shapefiles in DB manager, but it is dynamic and much more flexible (pick which columns to join, distance threshold for nearest neighbour, etc). If you use spatialite you can access the VirtualKNN feature directly within DB Manager. SQL is well worth exploring

    – she_weeds
    14 hours ago





    To answer your question @user32882 you can easily perform spatial joins and nearest neighbour queries in DB Manager using SQL. It may not be that fast if you are using shapefiles in DB manager, but it is dynamic and much more flexible (pick which columns to join, distance threshold for nearest neighbour, etc). If you use spatialite you can access the VirtualKNN feature directly within DB Manager. SQL is well worth exploring

    – she_weeds
    14 hours ago













    3














    The upper section, embeded layers, allows listing (and using) layers that are not loaded in QGIS table of content.



    Using an in-memory layer that is not loaded in QGIS is to be tested. I believe the layer is cleared from memory as soon as it is removed from the table of content.



    If you do have the in-memory layer loaded in the table of content, you can simply remove it from the embeded layers section, and the query will work. I just reproduced your use case and workaround in 3.4.5






    share|improve this answer



























      3














      The upper section, embeded layers, allows listing (and using) layers that are not loaded in QGIS table of content.



      Using an in-memory layer that is not loaded in QGIS is to be tested. I believe the layer is cleared from memory as soon as it is removed from the table of content.



      If you do have the in-memory layer loaded in the table of content, you can simply remove it from the embeded layers section, and the query will work. I just reproduced your use case and workaround in 3.4.5






      share|improve this answer

























        3












        3








        3







        The upper section, embeded layers, allows listing (and using) layers that are not loaded in QGIS table of content.



        Using an in-memory layer that is not loaded in QGIS is to be tested. I believe the layer is cleared from memory as soon as it is removed from the table of content.



        If you do have the in-memory layer loaded in the table of content, you can simply remove it from the embeded layers section, and the query will work. I just reproduced your use case and workaround in 3.4.5






        share|improve this answer













        The upper section, embeded layers, allows listing (and using) layers that are not loaded in QGIS table of content.



        Using an in-memory layer that is not loaded in QGIS is to be tested. I believe the layer is cleared from memory as soon as it is removed from the table of content.



        If you do have the in-memory layer loaded in the table of content, you can simply remove it from the embeded layers section, and the query will work. I just reproduced your use case and workaround in 3.4.5







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 19 at 11:23









        JGHJGH

        13.9k21339




        13.9k21339



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f319324%2fvirtual-layer-functionality-does-not-seem-to-support-memory-layers%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

            Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

            What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company