Python: How to create a Polygon Shapefile from a list of X,Y coordinates?

المشرف العام

Administrator
طاقم الإدارة
I have a list of X,Y coordinates from a csv file, that represent a polygon. I´m trying to create a Polygon-Shapefile from this list. I´ve been trying around and found a possbility to write the list to a Point-Shapefile.

Unfortunately that is not enough for me. Is there any way to get the coordinates in a Polygon-shapefile straight away?

Following Brad´s suggestions I tried the following code:

for i in list: w = shapefile.Writer(shapefile.POLYGON) w.poly(parts=
  • ) w.field('F_FLD','C','40') w.field('S_FLD','C','40') w.record('First','Polygon') w.save('C:/Users/.../Desktop/Shape')Unfortunately I´m getting an error message:

    ShapefileException: Failed to write shapefile bounding box. Floats required.Looks like there is a problem saving the shapefile to disk. This seems to be a similar question, but I couldn´t work out, how to get it going in my case.



    أكثر...
 
أعلى