Counting (Multi)Polygons Within (Multi)Polygons on same Table Planned maintenance scheduled...

Why weren't discrete x86 CPUs ever used in game hardware?

What is the "studentd" process?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?

Is there public access to the Meteor Crater in Arizona?

How would a mousetrap for use in space work?

How does the math work when buying airline miles?

Is openssl rand command cryptographically secure?

Test print coming out spongy

Understanding p-Values using an example

The Nth Gryphon Number

Asymptotics question

In musical terms, what properties are varied by the human voice to produce different words / syllables?

Why is a lens darker than other ones when applying the same settings?

Is there hard evidence that the grant peer review system performs significantly better than random?

Can two person see the same photon?

Random body shuffle every night—can we still function?

Project Euler #1 in C++

What does this say in Elvish?

How to ternary Plot3D a function

Drawing a ribbon graph

"klopfte jemand" or "jemand klopfte"?

I can't produce songs

Tannaka duality for semisimple groups

Why are vacuum tubes still used in amateur radios?



Counting (Multi)Polygons Within (Multi)Polygons on same Table



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Merge attribute data using spatial query in QGISWhat is the MS SQL Spatial syntax for counting points within polygons?Multiple geometry columns for points, lines, and polygons in spatialite?Get geometry column back when counting points in polygon using PostGISFinding Polygons which do not touch any other polygon in a single oracle database tableHow to perform SQL query using .STContains in MS SQL ServerSumming attribute values for areas where multiple polygons overlap using QGIS?How do I find points that are NOT within a list of polygons using MS SQL?Error validating geometry collection / multipolygon in PostGISPolygons overlapping points (not points within the polygon)





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







0















So I have a table with approximately 10k rows, with each row having its corresponding geometry entry. What I am attempting to do is count how many row geometries are contained/within the geometry of a single row as follows:



SELECT id, COUNT(*) FROM poly_table
WHERE WITHIN(poly_table.geom, poly_table.geom)
GROUP BY id ORDER BY COUNT(*) DESC;


However, all I get in return is a table with all rows having a COUNT(*) value of 1. So in understand they will certainly contain themselves but there are definitely polygons within polygons that are not accounted for. Help with this would be greatly appreciated! Thanks :D









share







New contributor




mich_techie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    0















    So I have a table with approximately 10k rows, with each row having its corresponding geometry entry. What I am attempting to do is count how many row geometries are contained/within the geometry of a single row as follows:



    SELECT id, COUNT(*) FROM poly_table
    WHERE WITHIN(poly_table.geom, poly_table.geom)
    GROUP BY id ORDER BY COUNT(*) DESC;


    However, all I get in return is a table with all rows having a COUNT(*) value of 1. So in understand they will certainly contain themselves but there are definitely polygons within polygons that are not accounted for. Help with this would be greatly appreciated! Thanks :D









    share







    New contributor




    mich_techie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      So I have a table with approximately 10k rows, with each row having its corresponding geometry entry. What I am attempting to do is count how many row geometries are contained/within the geometry of a single row as follows:



      SELECT id, COUNT(*) FROM poly_table
      WHERE WITHIN(poly_table.geom, poly_table.geom)
      GROUP BY id ORDER BY COUNT(*) DESC;


      However, all I get in return is a table with all rows having a COUNT(*) value of 1. So in understand they will certainly contain themselves but there are definitely polygons within polygons that are not accounted for. Help with this would be greatly appreciated! Thanks :D









      share







      New contributor




      mich_techie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      So I have a table with approximately 10k rows, with each row having its corresponding geometry entry. What I am attempting to do is count how many row geometries are contained/within the geometry of a single row as follows:



      SELECT id, COUNT(*) FROM poly_table
      WHERE WITHIN(poly_table.geom, poly_table.geom)
      GROUP BY id ORDER BY COUNT(*) DESC;


      However, all I get in return is a table with all rows having a COUNT(*) value of 1. So in understand they will certainly contain themselves but there are definitely polygons within polygons that are not accounted for. Help with this would be greatly appreciated! Thanks :D







      polygon sql geometry spatialite query





      share







      New contributor




      mich_techie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      mich_techie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      mich_techie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 min ago









      mich_techiemich_techie

      1




      1




      New contributor




      mich_techie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      mich_techie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      mich_techie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes












          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
          });


          }
          });






          mich_techie is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f319426%2fcounting-multipolygons-within-multipolygons-on-same-table%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          mich_techie is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          mich_techie is a new contributor. Be nice, and check out our Code of Conduct.













          mich_techie is a new contributor. Be nice, and check out our Code of Conduct.












          mich_techie is a new contributor. Be nice, and check out our Code of Conduct.
















          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%2f319426%2fcounting-multipolygons-within-multipolygons-on-same-table%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