Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. from shapely.geometry import Point, mapping, shape
  2. from fiona import collection
  3. #from shapely.ops import intersection
  4. import shapely.ops
  5.  
  6. bufSHP = 'data/h1_buf.shp'
  7. intSHP = 'data/h1_buf_int_ct.shp'
  8. ctSHP = 'data/nyct2010.shp'
  9. with collection(bufSHP, "r") as input:
  10. schema = input.schema.copy()
  11. with collection(intSHP, "w", "ESRI Shapefile", schema) as output:
  12. shapes = []
  13. for f in input:
  14. shapes.append(shape(f['geometry']))
  15. merged = shapes.intersection(ctSHP)
  16. output.write({
  17. 'properties': {
  18. 'uid': point['properties']['uid']
  19. },
  20. 'geometry': mapping(merged)
  21. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement