Guest User

Untitled

a guest
Dec 13th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. 37.0925854357,14.3860984446,0.0000079572,0.0000939491,0.0000028935
  2. 37.0978554286,14.5199850398,0.0000041594,0.0000821038,0.0000047924
  3. 37.1029267200,14.6538928343,0.0000024414,0.0000677266,0.0000050637
  4. 37.1077992514,14.7878210195,0.0000094944,0.0000632959,0.0000020797
  5.  
  6. import shapefile, csv
  7.  
  8. output_shp = shapefile.Writer(shapefile.POINT)
  9. output_shp.autoBalance = 1
  10. counter = 1
  11. with open('path/to/file.csv', 'rb') as csvfile:
  12. reader = csv.reader(csvfile, delimiter=',')
  13. for row in reader:
  14. lon= row[0]
  15. lat= row[1]
  16. output_shp.point(float(lon),float(lat))
  17. output_shp.record(lon, lat)
  18. counter = counter + 1
  19. # save the Shapefile
  20. output_shp.save('path/to/output/file.shp')
  21.  
  22. File "/usr/lib/python2.7/dist-packages/shapefile.py",line 986, in record
  23. if self.fields [0] [0] .startswith ("Deletion"): fieldCount - = 1
  24. IndexError: list index out of range
Add Comment
Please, Sign In to add comment