I've got a python script that is connecting a sequence of points to make lines (script is based on answers to my previous question). To attempt to make subsequent processing more efficient, I would like to do analysis/processing to each polyline as the points are connected, rather than storing them cumulatively in a shapefile (or feature class) and then reading them back into the script later. So the revised code (just the functional looping part, for the sake of brevity) is basically this:
for start in start_cursor: startFeature = start.getValue(shapefieldname) pnt1 = startFeature.getPart() for end in end_cursor: endFeature = end.getValue(shapefieldname) pnt2 = endFeature.getPart() point.X = pnt1.X point.Y = pnt1.Y array.add(point) point.X = pnt2.X point.Y = pnt2.Y array.add(point) polyline = arcpy.Polyline(array) arcpy.MakeFeatureLayer_management(polyline, "sightline_lyr")
However, MakeFeatureLayer_management doesn't seem to exactly be working. Any subsequent functions I want to apply (e.g.,
FeatureToRaster_conversion) to that new feature layer that was supposed to be created from that polyline has no data. If I add the new feature layer to the data frame while the script is running, it shows up in the table of contents in the appropriate data frame, but with the little red exclamation mark that indicates ArcMap can't find the data for that feature layer.
Is an arcpy.Polyline able to be made into a (temporary) feature layer? If not, how can I make a feature layer such that I can do more spatial analysis in further steps? (Short of "make a shapefile or feature class, then read it back in," preferably...)