Unnamed
public text v1 · immutablefor layer in section:
for p in layer:
geom = p.GetGeometryRef()
box = geom.GetEnvelope()
pts = 0
total = 0
while pts < 200:
total += 1
rpoint = "POINT(%.12f %.12f)" % (random.uniform(box[0], box[1]), random.uniform(box[2], box[3]))
#print rpoint, box
point = ogr.CreateGeometryFromWkt(rpoint)
check = geom.Contains(point)
if check is not False:
pts += 1;