I would like to create a pie chart-shaped polygon with concentric layers like so:
I can create this simple object with:
from math import sin, cos, radians
from shapely.geometry import Point,LineString
#variables for buffers
coordinates = (0,0)
point = Point(coordinates)
buffers=[]
outerRadius=100
numberOfCircles=5
radiusStep= outerRadius/numberOfCircles
innerRadius=radiusStep
pi=3.1415
#create the buffers
while innerRadius<=outerRadius:
buffers.append(point.buffer(innerRadius,200))
innerRadius+=radiusStep
#variables for linestrings
centerX = coordinates[0]
centerY = coordinates[1]
coordX=[]
coordY=[]
lines=[]
#create linestrings for circles
for i in xrange(1,361,45):
xCoord = centerX + outerRadius * cos(radians(i))
coordX.append(xCoord)
yCoord = centerY + outerRadius * sin(radians(i))
coordY.append(yCoord)
line = LineString([(centerX,centerY),(xCoord,yCoord)])
lines.append(line)
My question is this:
How can I take multiple shapely objects of different geometries and create a geofile (geojson, shapefile, etc...) so that each section of the "pie" is treated as a separate polygon.