import shapefile
w = shapefile.Writer(shapefile.POLYGON)
w.poly(parts=[[[0,50],[50,50],[50,0],[0,0],[0,50],[10,40],[10,10],[30,10],[30,40],[10,40],[70,20],[100,20],[100,0],[70,0],[70,20]]])
w.field('FIRST_FLD','C','40')
w.field('SECOND_FLD','C','40')
w.record('Poly','PolyTest')
w.save('TESTPOLY')
Any hints?
Thanks
Kurt
--
You received this message because you are subscribed to the Google Groups "Geospatial Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geospatialpyth...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hey - I just answered your question on StackExchange. The short answer is each one of your "sub" polygons (main, hole, island) needs it's own list inside the parts list. The code is with my answer (on my phone right now).I tested the change but let me know if you have issues.
--
Hello list,
as a bloody newbie I am trying to create a polygon with a hole plus an associated island (see black picture). I use the following code, but it does not work (see magenta picture)
import shapefile w = shapefile.Writer(shapefile.POLYGON) w.poly(parts=[[[0,50],[50,50],[50,0],[0,0],[0,50],[10,40],[10,10],[30,10],[30,40],[10,40],[70,20],[100,20],[100,0],[70,0],[70,20]]]) w.field('FIRST_FLD','C','40') w.field('SECOND_FLD','C','40') w.record('Poly','PolyTest') w.save('TESTPOLY')
Any hints?
Thanks
Kurt
You received this message because you are subscribed to the Google Groups "Geospatial Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geospatialpython+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.