def split_at_vertices(in_fc, out_fc): """Unique segments retained when poly geometry is split at vertices. """ gdb, _ = check_path(out_fc) if gdb is None: return None SR = getSR(in_fc) tmp, IFT = fc_geometry(in_fc, SR=SR, IFT_rec=False) ag = Geo(tmp, IFT) od = ag.polys_to_segments(as_basic=False, as_3d=False) tmp = "memory/tmp" if Exists(tmp): Delete_management(tmp) ags.da.NumPyArrayToTable(od, tmp) xyxy = list(od.dtype.names[:4]) args = [tmp, out_fc] + xyxy + ["GEODESIC", "Orig_id", SR] XYToLine_management(*args) return
def split_at_vertices(in_fc, out_fc): """Unique segments retained when poly geometry is split at vertices. """ result = check_path(out_fc) if result[0] is None: print(result[1]) return result[1] gdb, name = result SR = getSR(in_fc) a, IFT, IFT_2 = fc_geometry(in_fc, SR) ag = Geo(a, IFT) # fr_to = ag.unique_segments() # geo method fr_to = ag.polys_to_segments() dt = np.dtype([('X_orig', 'f8'), ('Y_orig', 'f8'), ('X_dest', 'f8'), ('Y_dest', 'f8')]) od = uts(fr_to, dtype=dt) # ---- unstructured to structured tmp = "memory/tmp" if arcpy.Exists(tmp): arcpy.Delete_management(tmp) arcpy.da.NumPyArrayToTable(od, tmp) args = [tmp, out_fc] + list(od.dtype.names) + ["GEODESIC", "", SR] arcpy.XYToLine_management(*args) return