Calculate coverage percentage of an area covered by shapefiles using GDAL? [closed]The minimum bounding circle of geometry that crosses the 180th meridianMosaicing indexed colour rasters with independent colour tablesPython, GDAL, VRT: help wth code efficiency and processing timeusing Python to calculate NDVI, output as a GeotiffCalculating Focal Statistics for Special Neighborhood?How to quantify the coverage area?How many percentage of sea area is covered with points?Can I multiply fractions in map algebra?Get field names of shapefiles using GDALCannot seem to load shapefiles using GDAL?

How to Keep Winged People Where They Belong?

How does an ideal op amp amplify a voltage input when the voltage difference is 0?

Dodging a Deathbeam travelling at speed of light

Players who play fast in longer time control games

Feasibility of keeping an Electrical Bike in poor (wet) storage conditions

Beam slope indicating accelerando or rallentando

On how/if I should ask my supervisor about lead authorship?

What is Trump's position on the whistle blower allegations? What does he mean by "witch hunt"?

Why the real and imaginary parts of a complex analytic function are not independent?

Complete the poem

Does the House Resolution about the Impeachment Inquiry change anything?

Does cashing a 3% share harm the company itself?

Cheat at Rock-Paper-Scissors-Lizard-Spock

What is the difference between the Ancient Greek religion and the Ancient Roman religion?

Why doesn't std::swap work on vector<bool> elements under Clang/Win?

Will being an emotionally numb 14 year-old prevent me from eventually being a pilot?

MOS 8502, just a 6510B?

Why do we worry about overfitting even if "all models are wrong"?

Famous statistical wins and horror stories for teaching purposes

Are there any galaxies visible in the night sky around the Orion constellation?

30 fake coins out of 99 coins v2

How do I recall Gooigi in co-op mode?

Proving there exist three different vectors that sum to zero

How to get a large amount of cash abroad if a debit card stops working?



Calculate coverage percentage of an area covered by shapefiles using GDAL? [closed]


The minimum bounding circle of geometry that crosses the 180th meridianMosaicing indexed colour rasters with independent colour tablesPython, GDAL, VRT: help wth code efficiency and processing timeusing Python to calculate NDVI, output as a GeotiffCalculating Focal Statistics for Special Neighborhood?How to quantify the coverage area?How many percentage of sea area is covered with points?Can I multiply fractions in map algebra?Get field names of shapefiles using GDALCannot seem to load shapefiles using GDAL?






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









2

















I have thousands of shapefiles covering around the world. I need to calculate coverage percentage. For example, a pixel located in Hawaii was covered by 100 of all shapefiles, then this pixel value of 100 will be output.



I can convert them to rasters, but I cannot stack all rasters in a file for calculation because of their large volume.



So, how can I calculate coverage percentage by using shapefiles or separated rasters?










share|improve this question


















closed as off-topic by ahmadhanb, Kadir Şahbaz, xunilk, LaughU, whyzar Jul 8 at 13:17


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – ahmadhanb, Kadir Şahbaz, xunilk, LaughU, whyzar
If this question can be reworded to fit the rules in the help center, please edit the question.























    2

















    I have thousands of shapefiles covering around the world. I need to calculate coverage percentage. For example, a pixel located in Hawaii was covered by 100 of all shapefiles, then this pixel value of 100 will be output.



    I can convert them to rasters, but I cannot stack all rasters in a file for calculation because of their large volume.



    So, how can I calculate coverage percentage by using shapefiles or separated rasters?










    share|improve this question


















    closed as off-topic by ahmadhanb, Kadir Şahbaz, xunilk, LaughU, whyzar Jul 8 at 13:17


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – ahmadhanb, Kadir Şahbaz, xunilk, LaughU, whyzar
    If this question can be reworded to fit the rules in the help center, please edit the question.



















      2












      2








      2








      I have thousands of shapefiles covering around the world. I need to calculate coverage percentage. For example, a pixel located in Hawaii was covered by 100 of all shapefiles, then this pixel value of 100 will be output.



      I can convert them to rasters, but I cannot stack all rasters in a file for calculation because of their large volume.



      So, how can I calculate coverage percentage by using shapefiles or separated rasters?










      share|improve this question

















      I have thousands of shapefiles covering around the world. I need to calculate coverage percentage. For example, a pixel located in Hawaii was covered by 100 of all shapefiles, then this pixel value of 100 will be output.



      I can convert them to rasters, but I cannot stack all rasters in a file for calculation because of their large volume.



      So, how can I calculate coverage percentage by using shapefiles or separated rasters?







      python gdal spatial-statistics






      share|improve this question
















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 6 at 10:44









      nmtoken

      8,7454 gold badges28 silver badges67 bronze badges




      8,7454 gold badges28 silver badges67 bronze badges










      asked Jul 6 at 8:40









      Kevin LeeKevin Lee

      112 bronze badges




      112 bronze badges





      closed as off-topic by ahmadhanb, Kadir Şahbaz, xunilk, LaughU, whyzar Jul 8 at 13:17


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – ahmadhanb, Kadir Şahbaz, xunilk, LaughU, whyzar
      If this question can be reworded to fit the rules in the help center, please edit the question.









      closed as off-topic by ahmadhanb, Kadir Şahbaz, xunilk, LaughU, whyzar Jul 8 at 13:17


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – ahmadhanb, Kadir Şahbaz, xunilk, LaughU, whyzar
      If this question can be reworded to fit the rules in the help center, please edit the question.







      closed as off-topic by ahmadhanb, Kadir Şahbaz, xunilk, LaughU, whyzar Jul 8 at 13:17


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – ahmadhanb, Kadir Şahbaz, xunilk, LaughU, whyzar
      If this question can be reworded to fit the rules in the help center, please edit the question.




















          2 Answers
          2






          active

          oldest

          votes


















          2


















          A conceptual solution would be to reclass all your rasters with 1 (covered) and 0 (not covered) and then use raster algebra to add all your rasters together. The pixel value will be the total value of all rasters which cover the given area. Take extra care to deal with different raster resolutions.






          share|improve this answer

































            0


















            You wouldn't need to convert all the shapefiles to raster at once, so volume consideration is a non-issue.



            Using a raster masking technique is going to result in imprecision at the pixel boundary -- Does a file which include the center of the pixel count as "covered" if not 100% of the pixel is covered? Using a vector technique could attain higher precision, at the cost of a lot of processing.



            In raster space, you just need to mask each vector at a time (with consideration as to whether you should take a one pixel (or sqrt(2)*pixeldim) negative buffer before masking), sum the presence/absence flag with a cumulator, and then divide by the number of shapefiles (encoding this as byte (either 0-100 or 0-250) would speed future processing, at the cost of precision)



            In vector space, you'd need to:



            • Determine the resolution of your percentage raster (pixel size, type and depth)

            • Create a partition vector to form the basis for subsetting the vector space which is in alignment with the raster (large enough to reduce the iterations, but small enough to save on vector overlay cost)

            • Iterate over the tiles with a clip and union of each shapefile, then compute percentage and convert that to raster, encode the desired pixel value, and mask this into a final raster.

            For most approaches to either technique, you're going to need a full GIS, not just GDAL and Python.






            share|improve this answer

































              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2


















              A conceptual solution would be to reclass all your rasters with 1 (covered) and 0 (not covered) and then use raster algebra to add all your rasters together. The pixel value will be the total value of all rasters which cover the given area. Take extra care to deal with different raster resolutions.






              share|improve this answer






























                2


















                A conceptual solution would be to reclass all your rasters with 1 (covered) and 0 (not covered) and then use raster algebra to add all your rasters together. The pixel value will be the total value of all rasters which cover the given area. Take extra care to deal with different raster resolutions.






                share|improve this answer




























                  2














                  2










                  2









                  A conceptual solution would be to reclass all your rasters with 1 (covered) and 0 (not covered) and then use raster algebra to add all your rasters together. The pixel value will be the total value of all rasters which cover the given area. Take extra care to deal with different raster resolutions.






                  share|improve this answer














                  A conceptual solution would be to reclass all your rasters with 1 (covered) and 0 (not covered) and then use raster algebra to add all your rasters together. The pixel value will be the total value of all rasters which cover the given area. Take extra care to deal with different raster resolutions.







                  share|improve this answer













                  share|improve this answer




                  share|improve this answer










                  answered Jul 6 at 9:23









                  vagvafvagvaf

                  9771 gold badge6 silver badges15 bronze badges




                  9771 gold badge6 silver badges15 bronze badges


























                      0


















                      You wouldn't need to convert all the shapefiles to raster at once, so volume consideration is a non-issue.



                      Using a raster masking technique is going to result in imprecision at the pixel boundary -- Does a file which include the center of the pixel count as "covered" if not 100% of the pixel is covered? Using a vector technique could attain higher precision, at the cost of a lot of processing.



                      In raster space, you just need to mask each vector at a time (with consideration as to whether you should take a one pixel (or sqrt(2)*pixeldim) negative buffer before masking), sum the presence/absence flag with a cumulator, and then divide by the number of shapefiles (encoding this as byte (either 0-100 or 0-250) would speed future processing, at the cost of precision)



                      In vector space, you'd need to:



                      • Determine the resolution of your percentage raster (pixel size, type and depth)

                      • Create a partition vector to form the basis for subsetting the vector space which is in alignment with the raster (large enough to reduce the iterations, but small enough to save on vector overlay cost)

                      • Iterate over the tiles with a clip and union of each shapefile, then compute percentage and convert that to raster, encode the desired pixel value, and mask this into a final raster.

                      For most approaches to either technique, you're going to need a full GIS, not just GDAL and Python.






                      share|improve this answer






























                        0


















                        You wouldn't need to convert all the shapefiles to raster at once, so volume consideration is a non-issue.



                        Using a raster masking technique is going to result in imprecision at the pixel boundary -- Does a file which include the center of the pixel count as "covered" if not 100% of the pixel is covered? Using a vector technique could attain higher precision, at the cost of a lot of processing.



                        In raster space, you just need to mask each vector at a time (with consideration as to whether you should take a one pixel (or sqrt(2)*pixeldim) negative buffer before masking), sum the presence/absence flag with a cumulator, and then divide by the number of shapefiles (encoding this as byte (either 0-100 or 0-250) would speed future processing, at the cost of precision)



                        In vector space, you'd need to:



                        • Determine the resolution of your percentage raster (pixel size, type and depth)

                        • Create a partition vector to form the basis for subsetting the vector space which is in alignment with the raster (large enough to reduce the iterations, but small enough to save on vector overlay cost)

                        • Iterate over the tiles with a clip and union of each shapefile, then compute percentage and convert that to raster, encode the desired pixel value, and mask this into a final raster.

                        For most approaches to either technique, you're going to need a full GIS, not just GDAL and Python.






                        share|improve this answer




























                          0














                          0










                          0









                          You wouldn't need to convert all the shapefiles to raster at once, so volume consideration is a non-issue.



                          Using a raster masking technique is going to result in imprecision at the pixel boundary -- Does a file which include the center of the pixel count as "covered" if not 100% of the pixel is covered? Using a vector technique could attain higher precision, at the cost of a lot of processing.



                          In raster space, you just need to mask each vector at a time (with consideration as to whether you should take a one pixel (or sqrt(2)*pixeldim) negative buffer before masking), sum the presence/absence flag with a cumulator, and then divide by the number of shapefiles (encoding this as byte (either 0-100 or 0-250) would speed future processing, at the cost of precision)



                          In vector space, you'd need to:



                          • Determine the resolution of your percentage raster (pixel size, type and depth)

                          • Create a partition vector to form the basis for subsetting the vector space which is in alignment with the raster (large enough to reduce the iterations, but small enough to save on vector overlay cost)

                          • Iterate over the tiles with a clip and union of each shapefile, then compute percentage and convert that to raster, encode the desired pixel value, and mask this into a final raster.

                          For most approaches to either technique, you're going to need a full GIS, not just GDAL and Python.






                          share|improve this answer














                          You wouldn't need to convert all the shapefiles to raster at once, so volume consideration is a non-issue.



                          Using a raster masking technique is going to result in imprecision at the pixel boundary -- Does a file which include the center of the pixel count as "covered" if not 100% of the pixel is covered? Using a vector technique could attain higher precision, at the cost of a lot of processing.



                          In raster space, you just need to mask each vector at a time (with consideration as to whether you should take a one pixel (or sqrt(2)*pixeldim) negative buffer before masking), sum the presence/absence flag with a cumulator, and then divide by the number of shapefiles (encoding this as byte (either 0-100 or 0-250) would speed future processing, at the cost of precision)



                          In vector space, you'd need to:



                          • Determine the resolution of your percentage raster (pixel size, type and depth)

                          • Create a partition vector to form the basis for subsetting the vector space which is in alignment with the raster (large enough to reduce the iterations, but small enough to save on vector overlay cost)

                          • Iterate over the tiles with a clip and union of each shapefile, then compute percentage and convert that to raster, encode the desired pixel value, and mask this into a final raster.

                          For most approaches to either technique, you're going to need a full GIS, not just GDAL and Python.







                          share|improve this answer













                          share|improve this answer




                          share|improve this answer










                          answered Jul 6 at 11:13









                          VinceVince

                          15.6k4 gold badges32 silver badges50 bronze badges




                          15.6k4 gold badges32 silver badges50 bronze badges
















                              Popular posts from this blog

                              Distance measures on a map of a game The 2019 Stack Overflow Developer Survey Results Are Inmin distance in a graphShortest distance path on contour plotHow to plot a tilted map?Finding points outside of a diskDelaunay link distanceAnnulus from GeoDisks: drawing a ring on a mapNegative Correlation DistanceFind distance along a path (GPS coordinates)Finding position at given distance in a GeoPathMathematics behind distance estimation using camera

                              apt-get update fails to fetch files, “Temporary failure resolving …” errorWhy does apt-get fail to resolve the mirror?Apt-get update not working in Ubuntu 16.04 “temporary failure resolving”Ubuntu 16.04 Server updates - Temporary failure resolving 'ro.archive.ubuntu.com'“Failed to fetch… Temporary failure resolving…” when trying to installTemporary failure resolving ca.archive.ubuntu.comUbuntu 18.04 sudo apt update doesn't work (Failed to Fetch)apt-get error: “Temporary failure resolving 'archive.ubuntu.com' ”“Temporary failure resolving us.archive.ubuntu.com” Live USB rescueTemporary failure resolving 'es.archive.ubuntu.com' on Ubuntu Server15.04 Server fails to update with failed to fetch temporary failure resolving errorsCan't install software from Software CenterApt-get failed to fetch from Ubuntu server with error code 404“Unable to connect” error with apt-get: possible proxy?v12.10 can't apt-get update111: Connection refused when trying apt updateSudo apt-get update

                              Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?