POST
|
Thanks. Is that documented anywhere that SearchCursor only returns the selected features?
... View more
09-23-2016
11:28 AM
|
0
|
0
|
166
|
POST
|
Using ArcMap 10.2.2, I created a simple Network Analyst Vehicle Routing problem with 8 points, and 1 depot, and solved it. I then saved the layer to a ".lyr" file and used the program below to output information about the points I had added: dirpath = "c:/temp"
env.workspace = dirpath
thelayer = "mike4.lyr"
na_layer = arcpy.mapping.Layer(os.path.join(dirpath, thelayer))
# Get the names of all the feature classes within the VRP layer.
sub_layer_names = arcpy.na.GetNAClassNames(na_layer)
# Stores the layer names that we will use later
orders_layer_name = sub_layer_names['Orders']
# Get the orders sublayer
orders_sublayer = arcpy.mapping.ListLayers(na_layer, orders_layer_name)[0]
# Get the orders
with arcpy.da.SearchCursor(in_table=orders_sublayer,
field_names=('Name','Description',
'RouteName','Sequence',
'SHAPE@XY')) as cursor:
for row in cursor:
print "Name ", row[0], "RouteName ", row[2], "Sequence ",row[3],"shape ",row[4]
The problem I was having is that it was only printing ONE of my 8 points I had created. I then discovered that when I saved the layer file in ArcMap, I had selected that single point. If I selected 4 of the 8 points, and saved, it only printed those 4 points. So my question is, what is the right way to alter the above code so that it will print all the Orders independent of whether the layer file was saved and had some of the orders selected or not?
... View more
09-23-2016
09:19 AM
|
0
|
2
|
954
|
POST
|
The "Routing_ND" from StreetMap Premium was selected. I had someone else try it, and he has the same problem, so now we're convinced that the data is corrupted on the DVD's. We'll contact support to figure it out.
... View more
08-26-2016
02:36 PM
|
0
|
0
|
363
|
POST
|
I am using ArcMap 10.2.2 and a VERY new user. I have the StreetMap Premium for ArcGIS North America TomTom data, 2016 Release 1. I am testing how to create OD cost matrices. I create a simple map in ArcMap, creating one layer from the "Routing" feature from the NorthAmerica.gdb database into my workspace. Using NetworkAnalyst, I click "New OD Cost Matrix". I zoom into a city of my choosing (e.g., San Francisco), and click "Origins" in the "Network Analyst" window. Then I do "Create Network Location Tool" and then click a point on a street on the map. It takes over 20 seconds for ArcMap to respond, and then the point is "Unlocated". I do the same test with SanFrancisco.gdb in the tutorial, and have no issues, and the point gets located, so I think maybe something is missing from the data I copied over from the 7 DVD's. Is there a way to tell? I'd rather not spend the time copying the data again. I think it might have something to do about not having a spatial index, but don't know which spatial index I should create (i.e., on which feature of the network).
... View more
08-26-2016
01:32 PM
|
0
|
2
|
1750
|
Online Status |
Offline
|
Date Last Visited |
01-15-2021
10:52 AM
|