POST
|
Hey GeoNet! I've been struggling to find the best way to retrieve attributes from edges traversed in routes generated by a Find Routes GP service nested within another GP service. Currently, I'm returning edges in my outputs and storing the SourceOIDs as keys in a dictionary with empty values, then populating the values with the necessary attributes by referencing the OBJECTID field in a feature service of the source edges. This method works fine, but it requires that I republish a new table service each time I update the network dataset (may be unnecessary, but I'm still wrapping my head around server-side concepts so that's why I'm here). I'm updating the ND frequently enough that this has become cumbersome and I'm hoping there's a better way. Some details: The ND lives in a file geodatabase in a registered folder on a separate machine and is updated every 12 to 24 hours I need to pull the geometry token from the traversed edges to generate the final output of the larger GP service; the output from Find Routes is not sufficient for what I need to return The nature of the underlying data requires a total recreation with each ND update; since I'm not simply appending new edges to an existing ND and rebuilding, so there's no consistent OBJECTID sequence in the edges that I could potentially utilize Some questions/thoughts I've had: I'd like to entirely eliminate having to use a separate feature service to pull shapes/attributes; since the data is in a registered folder, could I get these values with a SearchCursor? If so, what is the proper path structure to use as a reference to the source edges? If I replaced the Find Routes service with a Copy Traversed Source Features GP service to generate the routes, would it provide more flexible alternatives to get the outputs I'm looking for? Related thought: would returning the output route layer in the Find Routes service and using that as an input to a separate Copy Traversed Source Features service be better practice? I've gotten to the point where I'm just spinning my wheels, so I hope that someone else has been faced with this issue and can provide some more insight. Thank you!
... View more
11-05-2018
08:19 AM
|
1
|
2
|
476
|
POST
|
Resurrecting this one: we just started using Pro within the last couple of weeks and I have successfully been able to utilize ND templates. Truly a lifesaver. Thank you!
... View more
06-16-2018
01:31 PM
|
0
|
0
|
648
|
POST
|
Thanks for the reply Jay. Unfortunately our organization isn't using Pro, so that door is mostly closed. I forgot to edit my post, but I did learn that versioning was possible (in fact, I had already registered the participating fcs as versioned before posting) but I still didn't have any success. The source for my edge features is too large for my poor little computer to handle and though I didn't realize it at the time, I was running out of memory mid-build. I have another workaround I'm experimenting with, so hopefully it will take care of it.
... View more
12-04-2017
07:27 PM
|
0
|
0
|
648
|
POST
|
Unfortunately, we're running 10.4.1, so that option isn't available. Good suggestion though! Hoping to get my hands on Pro sometime soon to play around with. However, if I was able to create a ND XML template via Pro through some other avenue, is there a "scenic route" I could possibly take to utilize that XML in 10.4?
... View more
12-04-2017
06:52 PM
|
0
|
0
|
648
|
POST
|
I'm working on some Python scripts to automate the rebuilding of a couple of different network datasets based on new data coming in from our SDE. To ensure I wouldn't experience any SDE related issues (not really a database guy), I set up the network datasets in a FGDB. However, I'm experiencing some performance issues have decided to try to move the NDs to a feature dataset in SDE. This is where my issues have started coming up. Since creating NDs isn't possible via ArcPy without getting into areas waaaay outside my skill level, I've got my scripts creating new edge and junction feature classes in memory, removing all rows in the participating ND feature classes, inserting the new features from memory into the empty participating feature classes, and rebuilding the existing ND. I created a new ND in our SDE, and attempted to run my first test, but hit issues when I began my update cursor to delete the participating features. Got the ol Workspace is Already in Transaction Mode error. I tried to register the feature dataset as versioned to see if that would help things, but since SDE NDs don't allow for versioning of feature classes that already participate in NDs, I couldn't. I'm at a loss here. Here's a code sample (sorry that it's an image, can't get code formatted to look right otherwise): existingJunctions = r"pathtoSDEFeatureDataset\Junctions" existingEdges = r"pathtoSDEFeatureDataset\Edges" networkDataset = r"pathtoSDEFeatureDataset\NetworkDataset_ND" edit = arcpy.da.Editor(r"path to SDE Database") #tried all parameter combinations before settling on False False edit.startEditing(False, False) #delete all rows from existing ND junctions with arcpy.da.UpdateCursor(existingJunctions, "*") as uCur: for row in uCur: uCur.deleteRow() #insert updated junctions from memory into participating junctions fc with arcpy.da.SearchCursor(junctions, "*") as sCur: with arcpy.da.InsertCursor(existingJunctions, "*") as iCur: for row in sCur: iCur.insertRow(row) #delete all rows from existing ND edges with arcpy.da.UpdateCursor(existingEdges, "*") as uCur: for row in uCur: uCur.deleteRow() #insert updated edges from memory into participating edges fc edgeFields = [f.name for f in arcpy.ListFields(existingEdges) if f.name != "SHAPE_Length"] edgeFields.insert(0, "SHAPE@") with arcpy.da.SearchCursor(fiber, fiberFields) as sCur: with arcpy.da.InsertCursor(existingFiber, fiberFields) as iCur: for row in sCur: iCur.insertRow(row) #end edit session edit.stopEditing(True) If there is a suggestion on how to get this code working OR another idea on how to handle regular updates of network datasets without manual creation of new NDs, please let me know. Any help is tremendously appreciated!!
... View more
12-02-2017
01:17 PM
|
0
|
5
|
1039
|
Title | Kudos | Posted |
---|---|---|
1 | 11-05-2018 08:19 AM |
Online Status |
Offline
|
Date Last Visited |
09-21-2023
11:17 AM
|