|
POST
|
Can you share a screenshot of the problem? I'm having a hard time visualizing how a scale bar is displaying area.
... View more
08-06-2015
12:56 PM
|
0
|
2
|
2173
|
|
POST
|
5000 features isn't that many, so I doubt that alone is the problem. What type of features are they? For example, are they polygons with a billion vertices each? Also, you say you add the feature classes. How many feature classes? How many attributes are in the freezing attribute table?
... View more
08-06-2015
12:39 PM
|
0
|
2
|
3126
|
|
POST
|
If none of the above helps, you may be interested in this post, which uses arcpy geometries to create perpendicular lines at a set interval.
... View more
08-05-2015
10:23 AM
|
0
|
0
|
748
|
|
POST
|
Here is an alternative way to get to your answer, using arcpy geometry objects, directly: >>> dict = {}
... with arcpy.da.SearchCursor("Topsoil",["SHAPE@","COLOR","Year"]) as cursor: # loop through the topsoil feature class
... for row in cursor:
... if row[2] in dict:
... if row[1] in dict[row[2]]:
... dict[row[2]][row[1]] = row[0].union(dict[row[2]][row[1]]) # combine all the reds and greens for that year
... else:
... dict[row[2]][row[1]] = row[0]
... else:
... dict[row[2]] = {row[1]:row[0]}
... arcpy.CopyFeatures_management("Topsoil",r'in_memory\newPolys') # copy schema + features
... arcpy.DeleteFeatures_management(r'in_memory\newPolys') # delete features
... insCursor = arcpy.da.InsertCursor(r'in_memory\newPolys',["SHAPE@","Year"]) # get ready to write
... for year in dict: # loop through dictionary
... if len(dict[year]) == 2: # does it have red AND green?
... newPoly = dict[year]['Green'].difference(dict[year]['Red']) # subtract red from green
... else:
... newPoly = dict[year]['Green'] # write the green poly if there is no red
... insCursor.insertRow([newPoly,year]) # insert the polygon
... View more
08-04-2015
03:05 PM
|
2
|
2
|
1367
|
|
POST
|
Here's a script that should get you most of the way there. There is some issue with indexing, thinking it's still on the previous line segment, but I'll leave that for you to sort out. ... perpLines = []
... fc = "line"
... sr = arcpy.Describe(fc).spatialReference
... perpLineSpacing = 1000
... perpLineLength = 1000
... with arcpy.da.SearchCursor(fc,"SHAPE@",spatial_reference=sr) as cursor:
... for row in cursor:
... for part in row[0]: # part = a line array
... for i in range(len(part)):
... if i==0: # first vertex
... perpLineCounter = 0
... else:
... dy = part.Y - part[i-1].Y
... dx = part.X - part[i-1].X
... segmentAngle = math.degrees(math.atan2(dy,dx))
... segmentLength = math.sqrt(math.pow(dy,2)+math.pow(dx,2))
... linesOnSegment = int(segmentLength/perpLineSpacing)
... for line in range(linesOnSegment+1):
... point = row[0].positionAlongLine(perpLineCounter * perpLineSpacing)
... left = arcpy.Point(point.centroid.X - (math.cos(math.radians(segmentAngle-90))*perpLineLength), point.centroid.Y - (math.sin(math.radians(segmentAngle-90))*perpLineLength))
... right = arcpy.Point(point.centroid.X + (math.cos(math.radians(segmentAngle-90))*perpLineLength), point.centroid.Y + (math.sin(math.radians(segmentAngle-90))*perpLineLength))
... perpLines.append(arcpy.Polyline(arcpy.Array([left,right]),sr))
... perpLineCounter += 1
... arcpy.CopyFeatures_management(perpLines ,r'in_memory\lines')
... View more
07-30-2015
02:08 PM
|
2
|
6
|
5406
|
|
POST
|
An easy way to do this is to use ET GeoWizards Create Station Lines tool (one example here). Aside from that, this is definitely possible using arcpy geometries, but it will take some tedious trig coding.
... View more
07-30-2015
10:52 AM
|
0
|
9
|
5406
|
|
POST
|
I think you're overthinking this. The following works for me: import arcpy
point = arcpy.GetParameterAsText(0)
pointFC = r'C:/junk/points.shp'
insCursor = arcpy.da.InsertCursor(pointFC,['POINT_X','POINT_Y','SHAPE@XY'])
with arcpy.da.SearchCursor(point,['POINT_X','POINT_Y','SHAPE@XY']) as cursor:
for row in cursor:
insCursor.insertRow([row[2][0],row[2][1],row[2]])
del insCursor A happy coincidence: the units recorded in the final "POINT_X" and "POINT_Y" fields will be in the units of "pointFC", regardless of the data frame's coordinate system.
... View more
07-29-2015
02:54 PM
|
2
|
16
|
4063
|
|
POST
|
Have you tried setting the processing extent environment (arcpy.env.extent)? edit: I see you have set the extent to match the slope raster. Can you calculate the extent of your input points, buffer by some amount to allow outside movement, and use that as the processing extent instead?
... View more
07-29-2015
01:55 PM
|
0
|
0
|
2130
|
|
POST
|
You can't save a shapefile (*.shp) inside a GDB feature class. Remove the .shp from the output file name, or save the shapefile in a folder instead. edit: I'm not exactly sure how you're specifying the output. Can you post a screen shot of the MRB buffer tool dialog just before you run the tool?
... View more
07-29-2015
01:08 PM
|
1
|
1
|
3337
|
|
POST
|
for prow in arcpy.da.SearchCursor(point,'SHAPE@XY'): x,y = prow[0] del prow ^ this reads all your rows, one at a time, overwriting the values of x and y each time. So, in the end, you are left with one single pair of coordinates. A SearchCursor is like a for loop that cycles through all records and then stops. If you want to do something for each record in "point", you need to do it within the SearchCursor.
... View more
07-29-2015
11:01 AM
|
0
|
0
|
907
|
|
POST
|
It's tough to help without knowing how it doesn't work - is there an error? Your current example assigns values to variables POINT_X and POINT_Y which are never used. However, since your InsertCursor and SearchCursor happen to use the exact same fields, you should be able to use the entire row from the SearchCursor to insert into the InsertCursor. insCursor = arcpy.da.InsertCursor(pointFC,('POINT_X','POINT_Y','SHAPE@XY')) # create insert cursor
with arcpy.da.SearchCursor(point,('POINT_X','POINT_Y','SHAPE@XY')) as cursor: # loop through feature set
for row in cursor:
insCursor.insertRow(row) # insert row Try this. If it doesn't work, reply with error message or explanation how it fails to work.
... View more
07-29-2015
09:52 AM
|
0
|
2
|
907
|
|
POST
|
NameError: name 'centroid' is not defined ^ means there is no variable yet defined as "centroid". This "centroid" thing you are looking for is a property of a PointGeometry. A PointGeometry's centroid is a Point, which has properties 'X' and 'Y'. Using SHAPE@XY: This returns an x,y tuple, not a geometry object. You can create a Point from this tuple like so: point = arcpy.Point(row[2][0],row[2][1])
print point.X
print point.Y Using SHAPE@: This returns the geometry itself, so if you are reading points, row[2] will be a point object.
... View more
07-28-2015
03:52 PM
|
0
|
4
|
2670
|
|
POST
|
I'm not sure if that's necessary, but I do know that would work. This tool promises to do simple regression, but I've never used it: Ordinary Least Squares (OLS)—Help | ArcGIS for Desktop
... View more
07-28-2015
01:58 PM
|
0
|
0
|
3745
|
|
POST
|
Please indicate how you intend to share this content (see the list Xander provided). I'm guessing ArcGIS Online would be a good place for you to consider, but you may have other ideas.
... View more
07-28-2015
01:51 PM
|
1
|
3
|
1889
|
|
POST
|
You could do this painfully using a combination of field calculator, summary statistics, and joins, however I think you'd be better off exporting your table to Excel or dedicated statistical program, perform your regression, then join the result back to your polygons.
... View more
07-28-2015
01:34 PM
|
0
|
2
|
3745
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-25-2015 01:51 PM | |
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|