AnsweredAssumed Answered

phyton script

Question asked by fright on Jun 22, 2015
Latest reply on Jun 23, 2015 by fright

Hi there,

 

I need some help.

 

For creating polygons on the same latitude, I asked it several days ago.

It's the link.

 

creating polygons on the same latitude

 

Darren Wiens gave me a phyton script.

But whenever I tried the script on my arcgis, it was shut down.

 

I'm wondering about whether it's problem of the script, my shapefile or my arcgis.

 

Because of my shitty desktop, I tried to reduced the number of copy and my shapefile is so simplified (it's below 5kb).

It's the link

sk.zip - Google Drive

 

And it's the script I used.

I just replaced Darren's 'polys' with 'sk'.

 

 

  1. >>> fc = "sk" 
  2. ... outsk = [] 
  3. ... numCopies = 100 
  4. ... distBtw = 10000 
  5. ... sr = arcpy.Describe(fc).spatialReference 
  6. ... with arcpy.da.SearchCursor(fc,["SHAPE@"],spatial_reference=sr) as cursor: 
  7. ...     for row in cursor: 
  8. ...         for i in range(1,numCopies+1): 
  9. ...             array = arcpy.Array() 
  10. ...             for part in row[0]: 
  11. ...                 for pnt in part: 
  12. ...                     array.append(arcpy.Point(pnt.X+distBtw*i,pnt.Y)) 
  13. ...             outsk.append(arcpy.Polygon(array,sr)) 
  14. ... arcpy.CopyFeatures_management(outsk,r'in_memory\outsk')

Outcomes