|
POST
|
You appear to be cumulatively adding the total shape length of the entire polygon to the perimeter variable for each point along the perimeter that you encounter. The length between points would require a euclidean distance calculation between all point pairs that make up the part being added as you traverse the part. The Shape.Length field (row[3]) should already be the perimeter of the polygon if this shapefile was converted from a geodatabase feature class or calculated using the geometry calculator. Did you mean to update the Shape.Length field after determining the perimeter? If so you need to use an UpdateCursor, not a SearchCursor. I believe something more like this untested code should work if you wanted to get the euclidean distances from a shapefile that is using a Spatial Reference with linear units (however, Dan's option of using getLength from the geometry may be all you need to do): for row in cursor:
# Create the geometry object
#
feat = row[1]
partnum = 0
perimeter = 0
# Step through each part of the feature
#
for part in feat:
# Print the part number
#
print "Part %i:" % partnum
lastpnt = None
# Step through each vertex in the feature
#
for pnt in feat.getPart(partnum):
if pnt:
# Print x,y coordinates of current point
#
print pnt.X, pnt.Y
if lastpnt == None:
lastpnt = pnt
else:
perimeter += math.sqrt((pnt.X - lastpnt.X) ** 2 + (pnt.Y - lastpnt.Y) ** 2)
else:
# If pnt is None, this represents an interior ring
#
print "Interior Ring:"
lastpnt = None
partnum += 1
... View more
12-14-2014
11:11 AM
|
1
|
5
|
4239
|
|
POST
|
Typically this occurs when the feature class/table is in Editor mode which won't permit the schema to be modified as long as edits are occurring, or the table is open in another session (including viewing it on the same computer in two different sessions of Desktop or in both Catalog and Desktop at the same time) and you cannot get an exclusive lock on the feature class/table. Not as sure in the Online environment, but I expect the exclusive lock requirement still holds true. The listed restrictions affecting Add, Delete and Calculate in the online environment include: Add, Delete, and Calculate are not available for copies of layers. Add, Delete, and Calculate are only available for hosted feature layers or tables. You must be the owner of the hosted feature layer, or an administrator of your organization.
... View more
12-14-2014
09:53 AM
|
2
|
1
|
1150
|
|
POST
|
If your Street Light table contains Longitude and Latitude in the WGS 1984 projection (used by Google and most GPS devices) or X and Y coordinates in the spatial reference you normally use locally, then the table is a feature class as soon as you use the Make XY Event Layer tool or right click the table and set up its XY Event layer option. If it contains an ID that relates it to a pole position in a separate feature class, then you can calculate the X and Y coordinates of the poles into the pole feature class and join the pole feature class to the table and fill in the X and Y coordinates into the table. After that the table can be a feature class using the XY Event layer option. In a sense, the latter situation is better, since if you repeatedly capture new GPS coordinates each time you inspect the pole or log a new bulb, outage or repair you will get minor variations in the coordinates that make it harder to tell what features should be summarized. You always want the same pole coordinates each time for the one-to-many relationship so that it is easier to do Spatial Joins, summaries, or Collect Event operations to get counts of the number of bulbs, inspections, outages, repairs, etc and the one-to-many relationship allows you to achieve that. You may have two sets of coordinates, one for the GPS capture of the bulbs, inspection, repair, etc, and a second for the pole position, but for accounting purposes and map displays I am sure you want everything to match up to the one pole coordinate pair every time. Normally for a printed map one-to-many relationships that would create overlapping features get mapped using summary values rolled up to the one pole point, rather than trying to show each individual event for the single position, and you include a group ID value label that relates the count to the individual line items shown in a separate table sorted by that group ID. But the XY Event table allows you to overlap the points and do labeling, etc for the individual events when you need that. But I find that maps which do display all of the overlapping events or filtered groupings of overlapping events are best to interact with live and use the Identify tool to see the individual event listings for a position without trying to show every distinct event as a separate visual item or label on the map.
... View more
12-07-2014
07:31 AM
|
0
|
0
|
2359
|