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;
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
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
add a comment
|
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
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
add a comment
|
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
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
python gdal spatial-statistics
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
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
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
add a comment
|
add a comment
|
2 Answers
2
active
oldest
votes
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.
add a comment
|
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.
add a comment
|
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
add a comment
|
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.
add a comment
|
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.
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.
answered Jul 6 at 9:23
vagvafvagvaf
9771 gold badge6 silver badges15 bronze badges
9771 gold badge6 silver badges15 bronze badges
add a comment
|
add a comment
|
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.
add a comment
|
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.
add a comment
|
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.
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.
answered Jul 6 at 11:13
VinceVince
15.6k4 gold badges32 silver badges50 bronze badges
15.6k4 gold badges32 silver badges50 bronze badges
add a comment
|
add a comment
|