All pastes #460112 Raw Edit

Unnamed

public text v1 · immutable
#460112 ·published 2007-04-26 21:19 UTC
rendered paste body
for 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;