What is the most efficient way to find total area covered by a bunch of polygons?What is the most effective way for float and double comparison?Most efficient way to concatenate strings?Most efficient way to increment a Map value in JavaWhat is the most “pythonic” way to iterate over a list in chunks?Most efficient way to reverse a numpy arrayWhat is the most efficient way of finding all the factors of a number in Python?What is the most efficient way to loop through dataframes with pandas?floating points precision in complicated calculationsconfusion in run time measure with time.clock()!Place points with variable density

If Trump gets impeached, how long would Pence be president?

Polyhedra, Polyhedron, Polytopes and Polygon

Could the rotation of a black hole cause other planets to rotate?

Why is 'n' preferred over "n" for output streams?

How much were the LMs maneuvered to their landing points?

Pointwise convergence of uniformly continuous functions to zero, but not uniformly

If a 2019 UA artificer has the Repeating Shot infusion on two hand crossbows, can they use two-weapon fighting?

Writing a clean implementation of rock–paper–scissors game in C++

Is it legal to use cash pulled from a credit card to pay the monthly payment on that credit card?

What is the most efficient way to write 'for' loops in Matlab?

Why/when is AC-DC-AC conversion superior to direct AC-AC conversion?

Symplectisation as a functor between appropriate categories

Checking if an integer is a member of an integer list

Isolated audio without a transformer

Why do planes need a roll motion?

How do I explain an exponentially complex intuitively?

Decreasing star count

Why do all my history books divide Chinese history after the Han dynasty?

Examples of simultaneous independent breakthroughs

Request for a Latin phrase as motto "God is highest/supreme"

Defining a Function programmatically

How could Nomadic scholars effectively memorize libraries worth of information

Why is drive/partition number still used?

Can anyone give a concrete example to illustrate what is an uniform prior?



What is the most efficient way to find total area covered by a bunch of polygons?


What is the most effective way for float and double comparison?Most efficient way to concatenate strings?Most efficient way to increment a Map value in JavaWhat is the most “pythonic” way to iterate over a list in chunks?Most efficient way to reverse a numpy arrayWhat is the most efficient way of finding all the factors of a number in Python?What is the most efficient way to loop through dataframes with pandas?floating points precision in complicated calculationsconfusion in run time measure with time.clock()!Place points with variable density






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








1















I'm working on this project in Python where I have a bunch of polygons representing the clear-sky area on the Earth. I also have some polygons representing spots where a satellite looks (they're essentially squares). I'm trying to figure out how much clear area has been covered by the satellite, and I can do that, but it takes forever. Now I'm wondering how to speed up the calculation process.



It is OK to approximate fairly heavily, I sure have already.



  1. Initially, I tried to make all the geometry functions myself, (e.g. intersection of a polygon with another, area of polygon) and that was generally going okay, but my code was slow.


  2. Discovered the Shapely library. It's pretty great! Thanks to the people involved with that. Now I use Shapely shapes for the polygons, and finding intersections and areas etc. is super easy. However, it's not always super fast.


  3. Because the area calculation was taking so long, I have given up on trying to make it accurate, now I am just going for something proportional to area. I am now using the number of points (which are centroids of the initial polygons) covered by a polygon as my value for area. If you can get this to calculate real area in a good time, I will give you extra imaginary points.


I think currently the code is not horrible, and maybe there's not much more I can do as far as optimization, but wanted to throw it out there in case anyone has ideas.



As much as it has saved me some time, use of Shapely is not a requirement for this code.



One idea I have had was that I should take all the small polygons and join them into a mega-polygon and calculate the overlap area with that, but I'm not sure how to do that.



Running on Ubuntu (not that it really matters here, right?), and using Python 3.7. If you'd like any other details I'd be happy to give more info.



`



# for the area stuff we care about
import numpy as np
from shapely.geometry import Polygon, Point

# for timing things
from functools import wraps
from time import time

def timing(f):
"""Prints elapsed time after a function runs"""
# Thanks, яүυк!
# https://codereview.stackexchange.com/questions/169870/decorator-to-measure-execution-time-of-a-function
# I'm aware the timing won't be perfect, this is just to get an idea

@wraps(f)
def wrapper(*args, **kwargs):
start = time()
result = f(*args, **kwargs)
end = time()
print('Elapsed time: '.format(end-start))
return result
return wrapper

@timing
def generate_points_polys():
"""I do this in a different way in the actual code, but have simplified
the approach for this question"""
# domain of interest
x_low = -1000
x_high = 1000
y_low = -1000
y_high = 1000
resolution = 0.1

# these are the points I want to cover
x_points = np.arange(x_low, x_high, resolution)
y_points = np.arange(y_low, y_high, resolution)

# convert them into shapely points for easier geometrical operations
points = zip(x_points, y_points)
points = np.array([Point(x, y) for x, y in points], dtype=object)

# generate polygons
polys_per_col = 10
polys_per_row = 10
polys = np.empty((polys_per_col, polys_per_row), dtype=object)

for index, _ in np.ndenumerate(polys):
# let's say they're 5x5 for the sake of the question
# the shapes are dynamic in real life
x = np.random.uniform(low=x_low, high=x_high)
y = np.random.uniform(low=y_low, high=y_high)
vertices = [[x,y],[x+5,y],[x+5,y+5],[x,y+5]]
polys[index] = Polygon(vertices)
return points, polys

@timing
def calculate_area(points, polys):
"""This is the function we're trying to optimize"""
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
# get number of polygons at least partially covered
num_covered = len([1 for point in points if poly.intersects(point)])
# area is not equal to this but I figure it's proportional
# and calculating the real area would be expensive
areas[index] = num_covered
return areas

@timing
def do_the_things():
points, polys = generate_points_polys()
calculate_area(points, polys)

do_the_things()


`



I would like to be able to calculate the total area quickly, but it is taking a long time using the methods I've tried. Any ideas of code or different approximations I should use?



EDIT:



I have tried one of the suggestions in the comments, the one about using a MultiPolygon. Here are a couple trials involving that kind of thing, using the same number of points:



`



# Function 1, finds how many points are covered
def calculate_area(points, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
num_covered = len([1 for point in points if poly.intersects(point)])
areas[index] = num_covered
return areas

# Function 2, number of background polygons (b_polys) covered
def calculate_area2(b_polys, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
close_polys = [p for p in b_polys if poly.intersects(p)]
areas[index] = len(close_polys)
return areas

# Function 3, Function 2, but with actual areas
def calculate_area3(b_polys, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
close_polys = [p for p in b_polys if poly.intersects(p)]
total_area = 0
for p in close_polys:
total_area += p.area
areas[index] = total_area
return areas

# Function 4, calculates overlap area with cascaded_union
def calculate_area4(b_polys, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
area = shapely.ops.cascaded_union(list(b_polys)+[poly]).area
areas[index] = area
return areas


`



My findings (using the same timer above and the same number of points/polygons for each function):



`



Elapsed time (s)
1: 0.8620626926422119
2: 0.8469529151916504
3: 1.2330029010772705
4: 2.49029541015625


`










share|improve this question
























  • Have you heard of Monte Carlo methods? You might try that. For example: codereview.stackexchange.com/questions/69370/…

    – cosmic_inquiry
    Mar 26 at 19:07











  • I have heard the term but haven't really looked into it. I'll give that a shot!

    – C. McCracken
    Mar 26 at 19:20











  • You should probably combine all polygons into one multipolygon and compute its area. This seems like a function to do this: shapely.readthedocs.io/en/stable/…

    – zch
    Mar 26 at 19:21











  • Okay, thanks for the multipolygon link, I'll try that too.

    – C. McCracken
    Mar 26 at 19:25

















1















I'm working on this project in Python where I have a bunch of polygons representing the clear-sky area on the Earth. I also have some polygons representing spots where a satellite looks (they're essentially squares). I'm trying to figure out how much clear area has been covered by the satellite, and I can do that, but it takes forever. Now I'm wondering how to speed up the calculation process.



It is OK to approximate fairly heavily, I sure have already.



  1. Initially, I tried to make all the geometry functions myself, (e.g. intersection of a polygon with another, area of polygon) and that was generally going okay, but my code was slow.


  2. Discovered the Shapely library. It's pretty great! Thanks to the people involved with that. Now I use Shapely shapes for the polygons, and finding intersections and areas etc. is super easy. However, it's not always super fast.


  3. Because the area calculation was taking so long, I have given up on trying to make it accurate, now I am just going for something proportional to area. I am now using the number of points (which are centroids of the initial polygons) covered by a polygon as my value for area. If you can get this to calculate real area in a good time, I will give you extra imaginary points.


I think currently the code is not horrible, and maybe there's not much more I can do as far as optimization, but wanted to throw it out there in case anyone has ideas.



As much as it has saved me some time, use of Shapely is not a requirement for this code.



One idea I have had was that I should take all the small polygons and join them into a mega-polygon and calculate the overlap area with that, but I'm not sure how to do that.



Running on Ubuntu (not that it really matters here, right?), and using Python 3.7. If you'd like any other details I'd be happy to give more info.



`



# for the area stuff we care about
import numpy as np
from shapely.geometry import Polygon, Point

# for timing things
from functools import wraps
from time import time

def timing(f):
"""Prints elapsed time after a function runs"""
# Thanks, яүυк!
# https://codereview.stackexchange.com/questions/169870/decorator-to-measure-execution-time-of-a-function
# I'm aware the timing won't be perfect, this is just to get an idea

@wraps(f)
def wrapper(*args, **kwargs):
start = time()
result = f(*args, **kwargs)
end = time()
print('Elapsed time: '.format(end-start))
return result
return wrapper

@timing
def generate_points_polys():
"""I do this in a different way in the actual code, but have simplified
the approach for this question"""
# domain of interest
x_low = -1000
x_high = 1000
y_low = -1000
y_high = 1000
resolution = 0.1

# these are the points I want to cover
x_points = np.arange(x_low, x_high, resolution)
y_points = np.arange(y_low, y_high, resolution)

# convert them into shapely points for easier geometrical operations
points = zip(x_points, y_points)
points = np.array([Point(x, y) for x, y in points], dtype=object)

# generate polygons
polys_per_col = 10
polys_per_row = 10
polys = np.empty((polys_per_col, polys_per_row), dtype=object)

for index, _ in np.ndenumerate(polys):
# let's say they're 5x5 for the sake of the question
# the shapes are dynamic in real life
x = np.random.uniform(low=x_low, high=x_high)
y = np.random.uniform(low=y_low, high=y_high)
vertices = [[x,y],[x+5,y],[x+5,y+5],[x,y+5]]
polys[index] = Polygon(vertices)
return points, polys

@timing
def calculate_area(points, polys):
"""This is the function we're trying to optimize"""
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
# get number of polygons at least partially covered
num_covered = len([1 for point in points if poly.intersects(point)])
# area is not equal to this but I figure it's proportional
# and calculating the real area would be expensive
areas[index] = num_covered
return areas

@timing
def do_the_things():
points, polys = generate_points_polys()
calculate_area(points, polys)

do_the_things()


`



I would like to be able to calculate the total area quickly, but it is taking a long time using the methods I've tried. Any ideas of code or different approximations I should use?



EDIT:



I have tried one of the suggestions in the comments, the one about using a MultiPolygon. Here are a couple trials involving that kind of thing, using the same number of points:



`



# Function 1, finds how many points are covered
def calculate_area(points, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
num_covered = len([1 for point in points if poly.intersects(point)])
areas[index] = num_covered
return areas

# Function 2, number of background polygons (b_polys) covered
def calculate_area2(b_polys, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
close_polys = [p for p in b_polys if poly.intersects(p)]
areas[index] = len(close_polys)
return areas

# Function 3, Function 2, but with actual areas
def calculate_area3(b_polys, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
close_polys = [p for p in b_polys if poly.intersects(p)]
total_area = 0
for p in close_polys:
total_area += p.area
areas[index] = total_area
return areas

# Function 4, calculates overlap area with cascaded_union
def calculate_area4(b_polys, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
area = shapely.ops.cascaded_union(list(b_polys)+[poly]).area
areas[index] = area
return areas


`



My findings (using the same timer above and the same number of points/polygons for each function):



`



Elapsed time (s)
1: 0.8620626926422119
2: 0.8469529151916504
3: 1.2330029010772705
4: 2.49029541015625


`










share|improve this question
























  • Have you heard of Monte Carlo methods? You might try that. For example: codereview.stackexchange.com/questions/69370/…

    – cosmic_inquiry
    Mar 26 at 19:07











  • I have heard the term but haven't really looked into it. I'll give that a shot!

    – C. McCracken
    Mar 26 at 19:20











  • You should probably combine all polygons into one multipolygon and compute its area. This seems like a function to do this: shapely.readthedocs.io/en/stable/…

    – zch
    Mar 26 at 19:21











  • Okay, thanks for the multipolygon link, I'll try that too.

    – C. McCracken
    Mar 26 at 19:25













1












1








1








I'm working on this project in Python where I have a bunch of polygons representing the clear-sky area on the Earth. I also have some polygons representing spots where a satellite looks (they're essentially squares). I'm trying to figure out how much clear area has been covered by the satellite, and I can do that, but it takes forever. Now I'm wondering how to speed up the calculation process.



It is OK to approximate fairly heavily, I sure have already.



  1. Initially, I tried to make all the geometry functions myself, (e.g. intersection of a polygon with another, area of polygon) and that was generally going okay, but my code was slow.


  2. Discovered the Shapely library. It's pretty great! Thanks to the people involved with that. Now I use Shapely shapes for the polygons, and finding intersections and areas etc. is super easy. However, it's not always super fast.


  3. Because the area calculation was taking so long, I have given up on trying to make it accurate, now I am just going for something proportional to area. I am now using the number of points (which are centroids of the initial polygons) covered by a polygon as my value for area. If you can get this to calculate real area in a good time, I will give you extra imaginary points.


I think currently the code is not horrible, and maybe there's not much more I can do as far as optimization, but wanted to throw it out there in case anyone has ideas.



As much as it has saved me some time, use of Shapely is not a requirement for this code.



One idea I have had was that I should take all the small polygons and join them into a mega-polygon and calculate the overlap area with that, but I'm not sure how to do that.



Running on Ubuntu (not that it really matters here, right?), and using Python 3.7. If you'd like any other details I'd be happy to give more info.



`



# for the area stuff we care about
import numpy as np
from shapely.geometry import Polygon, Point

# for timing things
from functools import wraps
from time import time

def timing(f):
"""Prints elapsed time after a function runs"""
# Thanks, яүυк!
# https://codereview.stackexchange.com/questions/169870/decorator-to-measure-execution-time-of-a-function
# I'm aware the timing won't be perfect, this is just to get an idea

@wraps(f)
def wrapper(*args, **kwargs):
start = time()
result = f(*args, **kwargs)
end = time()
print('Elapsed time: '.format(end-start))
return result
return wrapper

@timing
def generate_points_polys():
"""I do this in a different way in the actual code, but have simplified
the approach for this question"""
# domain of interest
x_low = -1000
x_high = 1000
y_low = -1000
y_high = 1000
resolution = 0.1

# these are the points I want to cover
x_points = np.arange(x_low, x_high, resolution)
y_points = np.arange(y_low, y_high, resolution)

# convert them into shapely points for easier geometrical operations
points = zip(x_points, y_points)
points = np.array([Point(x, y) for x, y in points], dtype=object)

# generate polygons
polys_per_col = 10
polys_per_row = 10
polys = np.empty((polys_per_col, polys_per_row), dtype=object)

for index, _ in np.ndenumerate(polys):
# let's say they're 5x5 for the sake of the question
# the shapes are dynamic in real life
x = np.random.uniform(low=x_low, high=x_high)
y = np.random.uniform(low=y_low, high=y_high)
vertices = [[x,y],[x+5,y],[x+5,y+5],[x,y+5]]
polys[index] = Polygon(vertices)
return points, polys

@timing
def calculate_area(points, polys):
"""This is the function we're trying to optimize"""
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
# get number of polygons at least partially covered
num_covered = len([1 for point in points if poly.intersects(point)])
# area is not equal to this but I figure it's proportional
# and calculating the real area would be expensive
areas[index] = num_covered
return areas

@timing
def do_the_things():
points, polys = generate_points_polys()
calculate_area(points, polys)

do_the_things()


`



I would like to be able to calculate the total area quickly, but it is taking a long time using the methods I've tried. Any ideas of code or different approximations I should use?



EDIT:



I have tried one of the suggestions in the comments, the one about using a MultiPolygon. Here are a couple trials involving that kind of thing, using the same number of points:



`



# Function 1, finds how many points are covered
def calculate_area(points, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
num_covered = len([1 for point in points if poly.intersects(point)])
areas[index] = num_covered
return areas

# Function 2, number of background polygons (b_polys) covered
def calculate_area2(b_polys, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
close_polys = [p for p in b_polys if poly.intersects(p)]
areas[index] = len(close_polys)
return areas

# Function 3, Function 2, but with actual areas
def calculate_area3(b_polys, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
close_polys = [p for p in b_polys if poly.intersects(p)]
total_area = 0
for p in close_polys:
total_area += p.area
areas[index] = total_area
return areas

# Function 4, calculates overlap area with cascaded_union
def calculate_area4(b_polys, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
area = shapely.ops.cascaded_union(list(b_polys)+[poly]).area
areas[index] = area
return areas


`



My findings (using the same timer above and the same number of points/polygons for each function):



`



Elapsed time (s)
1: 0.8620626926422119
2: 0.8469529151916504
3: 1.2330029010772705
4: 2.49029541015625


`










share|improve this question
















I'm working on this project in Python where I have a bunch of polygons representing the clear-sky area on the Earth. I also have some polygons representing spots where a satellite looks (they're essentially squares). I'm trying to figure out how much clear area has been covered by the satellite, and I can do that, but it takes forever. Now I'm wondering how to speed up the calculation process.



It is OK to approximate fairly heavily, I sure have already.



  1. Initially, I tried to make all the geometry functions myself, (e.g. intersection of a polygon with another, area of polygon) and that was generally going okay, but my code was slow.


  2. Discovered the Shapely library. It's pretty great! Thanks to the people involved with that. Now I use Shapely shapes for the polygons, and finding intersections and areas etc. is super easy. However, it's not always super fast.


  3. Because the area calculation was taking so long, I have given up on trying to make it accurate, now I am just going for something proportional to area. I am now using the number of points (which are centroids of the initial polygons) covered by a polygon as my value for area. If you can get this to calculate real area in a good time, I will give you extra imaginary points.


I think currently the code is not horrible, and maybe there's not much more I can do as far as optimization, but wanted to throw it out there in case anyone has ideas.



As much as it has saved me some time, use of Shapely is not a requirement for this code.



One idea I have had was that I should take all the small polygons and join them into a mega-polygon and calculate the overlap area with that, but I'm not sure how to do that.



Running on Ubuntu (not that it really matters here, right?), and using Python 3.7. If you'd like any other details I'd be happy to give more info.



`



# for the area stuff we care about
import numpy as np
from shapely.geometry import Polygon, Point

# for timing things
from functools import wraps
from time import time

def timing(f):
"""Prints elapsed time after a function runs"""
# Thanks, яүυк!
# https://codereview.stackexchange.com/questions/169870/decorator-to-measure-execution-time-of-a-function
# I'm aware the timing won't be perfect, this is just to get an idea

@wraps(f)
def wrapper(*args, **kwargs):
start = time()
result = f(*args, **kwargs)
end = time()
print('Elapsed time: '.format(end-start))
return result
return wrapper

@timing
def generate_points_polys():
"""I do this in a different way in the actual code, but have simplified
the approach for this question"""
# domain of interest
x_low = -1000
x_high = 1000
y_low = -1000
y_high = 1000
resolution = 0.1

# these are the points I want to cover
x_points = np.arange(x_low, x_high, resolution)
y_points = np.arange(y_low, y_high, resolution)

# convert them into shapely points for easier geometrical operations
points = zip(x_points, y_points)
points = np.array([Point(x, y) for x, y in points], dtype=object)

# generate polygons
polys_per_col = 10
polys_per_row = 10
polys = np.empty((polys_per_col, polys_per_row), dtype=object)

for index, _ in np.ndenumerate(polys):
# let's say they're 5x5 for the sake of the question
# the shapes are dynamic in real life
x = np.random.uniform(low=x_low, high=x_high)
y = np.random.uniform(low=y_low, high=y_high)
vertices = [[x,y],[x+5,y],[x+5,y+5],[x,y+5]]
polys[index] = Polygon(vertices)
return points, polys

@timing
def calculate_area(points, polys):
"""This is the function we're trying to optimize"""
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
# get number of polygons at least partially covered
num_covered = len([1 for point in points if poly.intersects(point)])
# area is not equal to this but I figure it's proportional
# and calculating the real area would be expensive
areas[index] = num_covered
return areas

@timing
def do_the_things():
points, polys = generate_points_polys()
calculate_area(points, polys)

do_the_things()


`



I would like to be able to calculate the total area quickly, but it is taking a long time using the methods I've tried. Any ideas of code or different approximations I should use?



EDIT:



I have tried one of the suggestions in the comments, the one about using a MultiPolygon. Here are a couple trials involving that kind of thing, using the same number of points:



`



# Function 1, finds how many points are covered
def calculate_area(points, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
num_covered = len([1 for point in points if poly.intersects(point)])
areas[index] = num_covered
return areas

# Function 2, number of background polygons (b_polys) covered
def calculate_area2(b_polys, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
close_polys = [p for p in b_polys if poly.intersects(p)]
areas[index] = len(close_polys)
return areas

# Function 3, Function 2, but with actual areas
def calculate_area3(b_polys, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
close_polys = [p for p in b_polys if poly.intersects(p)]
total_area = 0
for p in close_polys:
total_area += p.area
areas[index] = total_area
return areas

# Function 4, calculates overlap area with cascaded_union
def calculate_area4(b_polys, polys):
areas = np.empty(polys.shape, dtype=float)
for index, poly in np.ndenumerate(polys):
area = shapely.ops.cascaded_union(list(b_polys)+[poly]).area
areas[index] = area
return areas


`



My findings (using the same timer above and the same number of points/polygons for each function):



`



Elapsed time (s)
1: 0.8620626926422119
2: 0.8469529151916504
3: 1.2330029010772705
4: 2.49029541015625


`







python optimization






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 20:47







C. McCracken

















asked Mar 26 at 18:46









C. McCrackenC. McCracken

414 bronze badges




414 bronze badges












  • Have you heard of Monte Carlo methods? You might try that. For example: codereview.stackexchange.com/questions/69370/…

    – cosmic_inquiry
    Mar 26 at 19:07











  • I have heard the term but haven't really looked into it. I'll give that a shot!

    – C. McCracken
    Mar 26 at 19:20











  • You should probably combine all polygons into one multipolygon and compute its area. This seems like a function to do this: shapely.readthedocs.io/en/stable/…

    – zch
    Mar 26 at 19:21











  • Okay, thanks for the multipolygon link, I'll try that too.

    – C. McCracken
    Mar 26 at 19:25

















  • Have you heard of Monte Carlo methods? You might try that. For example: codereview.stackexchange.com/questions/69370/…

    – cosmic_inquiry
    Mar 26 at 19:07











  • I have heard the term but haven't really looked into it. I'll give that a shot!

    – C. McCracken
    Mar 26 at 19:20











  • You should probably combine all polygons into one multipolygon and compute its area. This seems like a function to do this: shapely.readthedocs.io/en/stable/…

    – zch
    Mar 26 at 19:21











  • Okay, thanks for the multipolygon link, I'll try that too.

    – C. McCracken
    Mar 26 at 19:25
















Have you heard of Monte Carlo methods? You might try that. For example: codereview.stackexchange.com/questions/69370/…

– cosmic_inquiry
Mar 26 at 19:07





Have you heard of Monte Carlo methods? You might try that. For example: codereview.stackexchange.com/questions/69370/…

– cosmic_inquiry
Mar 26 at 19:07













I have heard the term but haven't really looked into it. I'll give that a shot!

– C. McCracken
Mar 26 at 19:20





I have heard the term but haven't really looked into it. I'll give that a shot!

– C. McCracken
Mar 26 at 19:20













You should probably combine all polygons into one multipolygon and compute its area. This seems like a function to do this: shapely.readthedocs.io/en/stable/…

– zch
Mar 26 at 19:21





You should probably combine all polygons into one multipolygon and compute its area. This seems like a function to do this: shapely.readthedocs.io/en/stable/…

– zch
Mar 26 at 19:21













Okay, thanks for the multipolygon link, I'll try that too.

– C. McCracken
Mar 26 at 19:25





Okay, thanks for the multipolygon link, I'll try that too.

– C. McCracken
Mar 26 at 19:25












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fstackoverflow.com%2fquestions%2f55364280%2fwhat-is-the-most-efficient-way-to-find-total-area-covered-by-a-bunch-of-polygons%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




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • 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%2fstackoverflow.com%2fquestions%2f55364280%2fwhat-is-the-most-efficient-way-to-find-total-area-covered-by-a-bunch-of-polygons%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

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현