Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Looked around and found other Cursor questions, but nothing dealing with updating 'SHAPE@LENGTH'. I am running ArcGIS 10.2.1 and have a multipoint shapefile that I am grouping into polygons based on a shared attribute. However, sometimes only one point has the attribute and so a very tiny polygon is drawn, as described by the minimum bounding geometry documentation (http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000003q000000).

I wanted to loop through the new polygon shapefile and use Update Cursor to access the tiny polygons' Geometry ('SHAPE@LENGTH') and bump it up to a visible level. I am unfortunately not understanding something because the changes to the length are not saved. I figured it would be harder than just reassigning the area value, but so far I can't understand what is going wrong:

import os
import arcpy

# Point data directory
polyFiles = 'C:\Users\...polyFiles'

# Polygon file made from the points
boxes = os.path.join(polyFiles, 'OE_AK_poly.shp')

# If length is less than 1000m bump it up so it's visible on the map
with arcpy.da.UpdateCursor(boxes, ["SHAPE@LENGTH"]) as cursor:
    for row in cursor:
        if row[0] < 1000:
            row[0] = 1000
        cursor.updateRow(row)
share|improve this question
    
What's your end goal here? –  ian Apr 2 at 16:53
    
Why not buffer the polygons by X that meet your if statement criteria? –  Aaron Apr 2 at 16:55
    
my end goal is for the tiny polygons to have a visible symbol on the map ("If length is less than 1000m bump it up so it's visible on the map"). –  sclarky Apr 2 at 19:57
    
My work around has been to buffer the polygons but it's an ugly script-- the Buffer tool will exclude anything that I do not want to buffer so it devolved into multiple files, some with buffered polygons, some not, then having to rejoin them. –  sclarky Apr 2 at 19:58
add comment

1 Answer 1

up vote 7 down vote accepted

In cursors, length is a read-only property.

I couldn't imagine what a predictable outcome would be for setting a new length of a line. Would it just extend the last point out in the bearing from the next to last point? What if it were multipart? Would it grow the entire polyline segment by segment?

share|improve this answer
2  
...so, you probably want to run Buffer on those tiny polygons to get them larger. Feels to be the easiest way to me. –  Alex Tereshenkov Apr 2 at 16:28
2  
Or a more aggressive symbology if it's just a visual thing –  Jason Scheirer Apr 2 at 16:32
    
cool...'read only' is the thing I was missing. Thanks. The buffering and symbology options I have both used, they're just not very elegant –  sclarky Apr 2 at 19:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.