Calculating point layer values aggregated by sub-polygons in QGIS 2 Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Updating field to give count of points in polygon using STIntersects?Using Select by Location toolHow to Count point in polygon + on boundary?Assigning the modal average based on points within a polygonQGIS 2.18.4 - Select by location returns no selectionHow to combine/merge attribute data from 1 layer to another, polygon to point, merge attributes and wrap/carriage return attributesQGIS Tool/Script to run that highlights location point features within their respective polygon feature based on the same parcel IDJoining attibutes by location + aggregation per fieldAutomating Select by location using ArcPy and where_clause?Count features in polygon by using aggregate (virtual field)Preserving geometry with Virtual Layer in QGIS 2

Is the argument below valid?

How to bypass password on Windows XP account?

Why don't the Weasley twins use magic outside of school if the Trace can only find the location of spells cast?

How discoverable are IPv6 addresses and AAAA names by potential attackers?

Detect existing key binding before creating one

Automatic sheet size in text label in QGIS

Single word antonym of "flightless"

When to stop saving and start investing?

When is phishing education going too far?

3 doors, three guards, one stone

Can inflation occur in a positive-sum game currency system such as the Stack Exchange reputation system?

How to find all the available tools in macOS terminal?

What is the meaning of new sigil in Game of Thrones Season 8 intro?

How to deal with my PhD supervisors rudely critiquing all my draft papers?

What causes the vertical darker bands in my photo?

How do I stop a creek from eroding my steep embankment?

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

Tower of moduli spaces in Scholze's theory

what is Samayachara? (I have read it in relation to 'Shri Vidya')

Does surprise arrest existing movement?

LaTeX gives error undefined control sequence table

What is the longest distance a 13th-level monk can jump while attacking on the same turn?

Can we unit test memory allocation?

Why is "Captain Marvel" translated as male in Portugal?



Calculating point layer values aggregated by sub-polygons in QGIS 2



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Updating field to give count of points in polygon using STIntersects?Using Select by Location toolHow to Count point in polygon + on boundary?Assigning the modal average based on points within a polygonQGIS 2.18.4 - Select by location returns no selectionHow to combine/merge attribute data from 1 layer to another, polygon to point, merge attributes and wrap/carriage return attributesQGIS Tool/Script to run that highlights location point features within their respective polygon feature based on the same parcel IDJoining attibutes by location + aggregation per fieldAutomating Select by location using ArcPy and where_clause?Count features in polygon by using aggregate (virtual field)Preserving geometry with Virtual Layer in QGIS 2



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








3















I simply have



  • a polygon layer BereichBerechnung with a field "Are_Number"

  • a point layer EW2017 with a field "EWjeAdr"

Example_of_data



In QGIS with a Virtual Layer, I want to calculate the sum of the field "EWjeAdr" for points that are within each sub-polygon from the layer BereichBerechnung.



I have found a related thread on this topic: STIntersects - Update field to give me count of points in polygon. Nevertheless, cannot figure it out how to adjust my expression properly, any suggestions?



SELECT Are_Number, SUM(EWjeAdr)
FROM BereichBerechnung
JOIN EW_Data
ON BereichBerechnung.ogr_geometry.STContains(EW2017.ogr_geometry) = 1;
GROUP BY Are_Number


I am getting the following error
Error



Any other smart suggestions/hints on how to aggregate values of a point layer based on polygons, e.g. IDs, should exclude application of Select Within plugin, Select by Location, Select Feature(s), Join attributes by location (summary) etc.










share|improve this question
























  • Do you have to do this in SQL?

    – TeddyTedTed
    Dec 6 '18 at 9:00











  • If you can suggest any other solution it would be great as well

    – Taras
    Dec 6 '18 at 9:22












  • This source says .STContains ( other_geometry )

    – Taras
    Dec 6 '18 at 10:19

















3















I simply have



  • a polygon layer BereichBerechnung with a field "Are_Number"

  • a point layer EW2017 with a field "EWjeAdr"

Example_of_data



In QGIS with a Virtual Layer, I want to calculate the sum of the field "EWjeAdr" for points that are within each sub-polygon from the layer BereichBerechnung.



I have found a related thread on this topic: STIntersects - Update field to give me count of points in polygon. Nevertheless, cannot figure it out how to adjust my expression properly, any suggestions?



SELECT Are_Number, SUM(EWjeAdr)
FROM BereichBerechnung
JOIN EW_Data
ON BereichBerechnung.ogr_geometry.STContains(EW2017.ogr_geometry) = 1;
GROUP BY Are_Number


I am getting the following error
Error



Any other smart suggestions/hints on how to aggregate values of a point layer based on polygons, e.g. IDs, should exclude application of Select Within plugin, Select by Location, Select Feature(s), Join attributes by location (summary) etc.










share|improve this question
























  • Do you have to do this in SQL?

    – TeddyTedTed
    Dec 6 '18 at 9:00











  • If you can suggest any other solution it would be great as well

    – Taras
    Dec 6 '18 at 9:22












  • This source says .STContains ( other_geometry )

    – Taras
    Dec 6 '18 at 10:19













3












3








3








I simply have



  • a polygon layer BereichBerechnung with a field "Are_Number"

  • a point layer EW2017 with a field "EWjeAdr"

Example_of_data



In QGIS with a Virtual Layer, I want to calculate the sum of the field "EWjeAdr" for points that are within each sub-polygon from the layer BereichBerechnung.



I have found a related thread on this topic: STIntersects - Update field to give me count of points in polygon. Nevertheless, cannot figure it out how to adjust my expression properly, any suggestions?



SELECT Are_Number, SUM(EWjeAdr)
FROM BereichBerechnung
JOIN EW_Data
ON BereichBerechnung.ogr_geometry.STContains(EW2017.ogr_geometry) = 1;
GROUP BY Are_Number


I am getting the following error
Error



Any other smart suggestions/hints on how to aggregate values of a point layer based on polygons, e.g. IDs, should exclude application of Select Within plugin, Select by Location, Select Feature(s), Join attributes by location (summary) etc.










share|improve this question
















I simply have



  • a polygon layer BereichBerechnung with a field "Are_Number"

  • a point layer EW2017 with a field "EWjeAdr"

Example_of_data



In QGIS with a Virtual Layer, I want to calculate the sum of the field "EWjeAdr" for points that are within each sub-polygon from the layer BereichBerechnung.



I have found a related thread on this topic: STIntersects - Update field to give me count of points in polygon. Nevertheless, cannot figure it out how to adjust my expression properly, any suggestions?



SELECT Are_Number, SUM(EWjeAdr)
FROM BereichBerechnung
JOIN EW_Data
ON BereichBerechnung.ogr_geometry.STContains(EW2017.ogr_geometry) = 1;
GROUP BY Are_Number


I am getting the following error
Error



Any other smart suggestions/hints on how to aggregate values of a point layer based on polygons, e.g. IDs, should exclude application of Select Within plugin, Select by Location, Select Feature(s), Join attributes by location (summary) etc.







sql qgis-2 select-by-location aggregation virtual-layer






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 6 '18 at 21:15









PolyGeo

54k1782246




54k1782246










asked Dec 6 '18 at 7:35









TarasTaras

2,3503729




2,3503729












  • Do you have to do this in SQL?

    – TeddyTedTed
    Dec 6 '18 at 9:00











  • If you can suggest any other solution it would be great as well

    – Taras
    Dec 6 '18 at 9:22












  • This source says .STContains ( other_geometry )

    – Taras
    Dec 6 '18 at 10:19

















  • Do you have to do this in SQL?

    – TeddyTedTed
    Dec 6 '18 at 9:00











  • If you can suggest any other solution it would be great as well

    – Taras
    Dec 6 '18 at 9:22












  • This source says .STContains ( other_geometry )

    – Taras
    Dec 6 '18 at 10:19
















Do you have to do this in SQL?

– TeddyTedTed
Dec 6 '18 at 9:00





Do you have to do this in SQL?

– TeddyTedTed
Dec 6 '18 at 9:00













If you can suggest any other solution it would be great as well

– Taras
Dec 6 '18 at 9:22






If you can suggest any other solution it would be great as well

– Taras
Dec 6 '18 at 9:22














This source says .STContains ( other_geometry )

– Taras
Dec 6 '18 at 10:19





This source says .STContains ( other_geometry )

– Taras
Dec 6 '18 at 10:19










2 Answers
2






active

oldest

votes


















1















For QGIS 3.4




In the Processing Toolbox use the tool Join attributes by location (summary), make sure it's the summary tool and not the other one.





For QGIS 2.18




In the Processing Toolbox use the tool Join attributes by location and change the Attribute summary option to Take summary of intersecting features.




The Input layer should be the polygon and the Join Layer should be the points.



I created two scratch layers in a project, in the point layer I populated a field with a random number ("rand_num"), see the result of the joined polygon here:



Result_of_execution






share|improve this answer

























  • Are you using QGIS 3 and higher? In QGIS 2.18, there are no Join attributes by location (summary). Thank you for the answer anyway.

    – Taras
    Dec 6 '18 at 10:08











  • Ah sorry yes I am using 3.4. Apologies. Instead use the 'Join attributes by location' tool and change the attribute summary option to 'Take summary of intersecting features'. Edited answer to reflect this. Looks like they split it into two tools in QGIS 3

    – TeddyTedTed
    Dec 6 '18 at 10:41



















1














With a bit of luck and suggestions from @Kazuhito, I ended up with



SELECT Are_Number, SUM(EWjeAdr)
FROM BereichBerechnung
JOIN EW_Data
ON contains(BereichBerechnung.geometry, EW_Data.geometry)
GROUP BY Are_Number



References:



  • QGIS Documentation | Supported language

  • SpatiaLite SQL functions reference list





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%2f305165%2fcalculating-point-layer-values-aggregated-by-sub-polygons-in-qgis-2%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









    1















    For QGIS 3.4




    In the Processing Toolbox use the tool Join attributes by location (summary), make sure it's the summary tool and not the other one.





    For QGIS 2.18




    In the Processing Toolbox use the tool Join attributes by location and change the Attribute summary option to Take summary of intersecting features.




    The Input layer should be the polygon and the Join Layer should be the points.



    I created two scratch layers in a project, in the point layer I populated a field with a random number ("rand_num"), see the result of the joined polygon here:



    Result_of_execution






    share|improve this answer

























    • Are you using QGIS 3 and higher? In QGIS 2.18, there are no Join attributes by location (summary). Thank you for the answer anyway.

      – Taras
      Dec 6 '18 at 10:08











    • Ah sorry yes I am using 3.4. Apologies. Instead use the 'Join attributes by location' tool and change the attribute summary option to 'Take summary of intersecting features'. Edited answer to reflect this. Looks like they split it into two tools in QGIS 3

      – TeddyTedTed
      Dec 6 '18 at 10:41
















    1















    For QGIS 3.4




    In the Processing Toolbox use the tool Join attributes by location (summary), make sure it's the summary tool and not the other one.





    For QGIS 2.18




    In the Processing Toolbox use the tool Join attributes by location and change the Attribute summary option to Take summary of intersecting features.




    The Input layer should be the polygon and the Join Layer should be the points.



    I created two scratch layers in a project, in the point layer I populated a field with a random number ("rand_num"), see the result of the joined polygon here:



    Result_of_execution






    share|improve this answer

























    • Are you using QGIS 3 and higher? In QGIS 2.18, there are no Join attributes by location (summary). Thank you for the answer anyway.

      – Taras
      Dec 6 '18 at 10:08











    • Ah sorry yes I am using 3.4. Apologies. Instead use the 'Join attributes by location' tool and change the attribute summary option to 'Take summary of intersecting features'. Edited answer to reflect this. Looks like they split it into two tools in QGIS 3

      – TeddyTedTed
      Dec 6 '18 at 10:41














    1












    1








    1








    For QGIS 3.4




    In the Processing Toolbox use the tool Join attributes by location (summary), make sure it's the summary tool and not the other one.





    For QGIS 2.18




    In the Processing Toolbox use the tool Join attributes by location and change the Attribute summary option to Take summary of intersecting features.




    The Input layer should be the polygon and the Join Layer should be the points.



    I created two scratch layers in a project, in the point layer I populated a field with a random number ("rand_num"), see the result of the joined polygon here:



    Result_of_execution






    share|improve this answer
















    For QGIS 3.4




    In the Processing Toolbox use the tool Join attributes by location (summary), make sure it's the summary tool and not the other one.





    For QGIS 2.18




    In the Processing Toolbox use the tool Join attributes by location and change the Attribute summary option to Take summary of intersecting features.




    The Input layer should be the polygon and the Join Layer should be the points.



    I created two scratch layers in a project, in the point layer I populated a field with a random number ("rand_num"), see the result of the joined polygon here:



    Result_of_execution







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 6 '18 at 11:51









    Taras

    2,3503729




    2,3503729










    answered Dec 6 '18 at 9:49









    TeddyTedTedTeddyTedTed

    81819




    81819












    • Are you using QGIS 3 and higher? In QGIS 2.18, there are no Join attributes by location (summary). Thank you for the answer anyway.

      – Taras
      Dec 6 '18 at 10:08











    • Ah sorry yes I am using 3.4. Apologies. Instead use the 'Join attributes by location' tool and change the attribute summary option to 'Take summary of intersecting features'. Edited answer to reflect this. Looks like they split it into two tools in QGIS 3

      – TeddyTedTed
      Dec 6 '18 at 10:41


















    • Are you using QGIS 3 and higher? In QGIS 2.18, there are no Join attributes by location (summary). Thank you for the answer anyway.

      – Taras
      Dec 6 '18 at 10:08











    • Ah sorry yes I am using 3.4. Apologies. Instead use the 'Join attributes by location' tool and change the attribute summary option to 'Take summary of intersecting features'. Edited answer to reflect this. Looks like they split it into two tools in QGIS 3

      – TeddyTedTed
      Dec 6 '18 at 10:41

















    Are you using QGIS 3 and higher? In QGIS 2.18, there are no Join attributes by location (summary). Thank you for the answer anyway.

    – Taras
    Dec 6 '18 at 10:08





    Are you using QGIS 3 and higher? In QGIS 2.18, there are no Join attributes by location (summary). Thank you for the answer anyway.

    – Taras
    Dec 6 '18 at 10:08













    Ah sorry yes I am using 3.4. Apologies. Instead use the 'Join attributes by location' tool and change the attribute summary option to 'Take summary of intersecting features'. Edited answer to reflect this. Looks like they split it into two tools in QGIS 3

    – TeddyTedTed
    Dec 6 '18 at 10:41






    Ah sorry yes I am using 3.4. Apologies. Instead use the 'Join attributes by location' tool and change the attribute summary option to 'Take summary of intersecting features'. Edited answer to reflect this. Looks like they split it into two tools in QGIS 3

    – TeddyTedTed
    Dec 6 '18 at 10:41














    1














    With a bit of luck and suggestions from @Kazuhito, I ended up with



    SELECT Are_Number, SUM(EWjeAdr)
    FROM BereichBerechnung
    JOIN EW_Data
    ON contains(BereichBerechnung.geometry, EW_Data.geometry)
    GROUP BY Are_Number



    References:



    • QGIS Documentation | Supported language

    • SpatiaLite SQL functions reference list





    share|improve this answer





























      1














      With a bit of luck and suggestions from @Kazuhito, I ended up with



      SELECT Are_Number, SUM(EWjeAdr)
      FROM BereichBerechnung
      JOIN EW_Data
      ON contains(BereichBerechnung.geometry, EW_Data.geometry)
      GROUP BY Are_Number



      References:



      • QGIS Documentation | Supported language

      • SpatiaLite SQL functions reference list





      share|improve this answer



























        1












        1








        1







        With a bit of luck and suggestions from @Kazuhito, I ended up with



        SELECT Are_Number, SUM(EWjeAdr)
        FROM BereichBerechnung
        JOIN EW_Data
        ON contains(BereichBerechnung.geometry, EW_Data.geometry)
        GROUP BY Are_Number



        References:



        • QGIS Documentation | Supported language

        • SpatiaLite SQL functions reference list





        share|improve this answer















        With a bit of luck and suggestions from @Kazuhito, I ended up with



        SELECT Are_Number, SUM(EWjeAdr)
        FROM BereichBerechnung
        JOIN EW_Data
        ON contains(BereichBerechnung.geometry, EW_Data.geometry)
        GROUP BY Are_Number



        References:



        • QGIS Documentation | Supported language

        • SpatiaLite SQL functions reference list






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 9 at 10:53

























        answered Dec 6 '18 at 11:23









        TarasTaras

        2,3503729




        2,3503729



























            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%2f305165%2fcalculating-point-layer-values-aggregated-by-sub-polygons-in-qgis-2%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

            Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

            Ромео және Джульетта Мазмұны Қысқаша сипаттамасы Кейіпкерлері Кино Дереккөздер Бағыттау мәзірі

            Википедия:Патрулирование Содержание Процедура патрулирования Версия, показываемая по умолчанию Флаг патрулирующего Флаг автопатрулируемого Техническая реализация Примечания См. также НавигацияАктуальный список патрулирующихэтим инструментомрейтинг патрулирующихпоказывал лишь 63 позицииРекурсивный поиск непатрулированных страниц по категорииРекурсивный поиск устаревших патрулированных страниц по категории