Pk19000 - 1 month ago 13

Python Question

I need to calculate the amount of two oval intersects in a python program.

I know in shaply there is a function that return true if two object has intersects. As like as this:

`from shapely.geometry import Polygon`

p1=Polygon([(0,0),(1,1),(1,0)])

p2=Polygon([(0,1),(1,0),(1,1)])

print p1.intersects(p2)

is there any library or function That help me?

Thanks.

Answer

Is this what you are looking for? (the polygon that results from the intersection)

```
x = p1.intersection(p2)
x.area
```

Find more information in the documentation here

Source (Stackoverflow)

Comments