|
POST
|
Glad you figured it out. Yes, the SearchCursor returns items in a tuple. You could have chosen to return more than one field (in addition to SHAPE@), and it would have returned something like (SHAPE@, Field, Field), so it makes sense that you have to use a [0] to get the first item in the tuple (even if there is only one item in it). The distance is, I believe, the distance along the route in the units of the coordinate system used by the route. If it's in a geographic coordinate system, you should probably project it into something appropriate for the area you're studying. Do your stops have a route ID associated with them? If so, you can use a loop to loop through the routes. For each route, you can use MakeFeatureLayer on the stops to select only the stops associated with the route ID, and then do the SearchCursor on the feature layer and loop through those stops to calculate the distance along the line. Something like this (which I didn't test, so it might not be perfect): cursorRoute = arcpy.da.SearchCursor(fcRoute,['SHAPE@', 'RouteID'])
for route in cursorRoute:
RouteID = route[1]
routeGeom = route[0]
where = '"RouteID" = %s' % str(RouteID)
arcpy.management.MakeFeatureLayer(fcStop, "Stops", where)
cursorStop = arcpy.da.SearchCursor(fcStop,['STOP_ID','SHAPE@'])
for stop in cursorStop:
stopGeom = stopGeom[1] # Looks like the geometry is the second item in your tuple here
dist_along_route = routeGeom.measureOnLine(stopGeom,FALSE)
... View more
03-12-2014
07:19 AM
|
0
|
0
|
1248
|
|
POST
|
You CAN use the Route tool to do this. Use the RouteName field in field mapping. You will need a separate, unique RouteName for each student, and you will need a separate copy of the student's school for each student that has the RouteName assigned to it. Naturally, this significantly increases the size of your input data. With so many students, you'll probably want to break it up into chunks. You can automate your workflow using python or ModelBuilder if you don't want to run each chunk manually. See this thread for more detailed information: http://forums.arcgis.com/threads/102763-shortest-distance
... View more
03-11-2014
07:23 AM
|
0
|
0
|
698
|
|
POST
|
Not a stupid question at all! You need to read in your shapefile or feature class using a search cursor (arcpy.da.SearchCursor). You can read in the shape geometry using the SHAPE@ keyword, and that should give you a point or a line geometry object. You then feed the point and line geometry objects to the measureOnLine method. There are some SearchCursor examples here: http://resources.arcgis.com/en/help/main/10.2/index.html#//018w00000011000000
... View more
03-10-2014
01:21 PM
|
0
|
0
|
3108
|
|
POST
|
Any stops with the same RouteName will end up on the same route. If you have Person 1 going to Park A, and you have three entrances for Park A (A1, A2, and A3), and you assign them all to RouteName 1, the route solver will produce a route like this: Person 1 -> A1 -> A2 -> A3. The route will have four stops, which I think isn't what you want. You need to choose just one of those park entrances as the second stop in your route. Alternatively, if you don't actually know which park/entrance each person is going to, you can use the Closest Facility solver. This will generate a route to the closest park or park entrance to each person. However, if you already have data reporting which park each person goes to, the closest one might not necessarily match.
... View more
03-06-2014
06:22 AM
|
0
|
0
|
1487
|
|
POST
|
Great. Just to clarify, the measureOnLine() function isn't available in 10.2, only in 10.2.1, which is a separate product. If you're going to upgrade, make sure you can upgrade all the way to 10.2.1 and not just 10.2.
... View more
03-04-2014
02:43 PM
|
0
|
0
|
3108
|
|
POST
|
So a pedestrian route might go something like this: street -> station entrance -> station connector -> station -> Rail line -> station -> station connector -> station entrance -> street (Tell me if I got that wrong). Since your station entrances interact with streets, those station entrances need to fall on street vertices or endpoints, depending on the connectivity settings you've given it (End Point vs. Any Vertex). If your street features don't have vertices at the locations of the entrances, you can use the Integrate tool to create vertices in the streets. Without vertices or endpoints, the station entrances will never connect with the streets, and the pedestrians will never be able to get to the rail lines, so your routes will not show any rail usage.
... View more
03-04-2014
09:46 AM
|
0
|
0
|
1546
|
|
POST
|
If your rail stations are being used as the points that connect two separate connectivity groups, and those rail stations don't touch the streets at all, then yes, that is the problem. The points have to touch both. Furthermore, the points need to fall on an endpoint or vertex (depending on your connectivity settings) of the feature classes they touch.
... View more
03-04-2014
07:59 AM
|
0
|
0
|
1546
|
|
POST
|
Hello, Sui Tao. I will try to help you out with this. What version of ArcGIS are you running? There's a new python method in ArcGIS 10.2.1 that would be perfect for what you're trying to do. It allows you to quickly find the distance along a line that a point falls. You could find the distance that each stop falls along the route they're assigned to and sort by that distance to determine the order. You have to create a Polyline geometry object for your route line and a Point geometry object for each stop. Then use the measureOnLine() method. You would end up with something like: dist_along_route = lineGeom.measureOnLine(ptGeom) See http://resources.arcgis.com/en/help/main/10.2/index.html#//018z00000070000000. Unfortunately, this simple method isn't available in ArcGIS versions prior to 10.2.1. If you don't have 10.2.1 yet, you could accomplish the same thing using the linear referencing tools. See http://resources.arcgis.com/en/help/main/10.2/index.html#//003m00000002000000. You would first use the Create Routes tool on your polyline routes. This just generates measures along those route lines so you can return the distance along the lines later. Then, you would use Locate Features Along Routes to determine the distance along each route that each stop falls. You could then extract the distance from the resulting table and sort it to determine your stop sequence. You would want to run the tool separately for each route in your system. If you have a lot of routes, this will likely be time consuming, as the linear referencing tools tend to run a bit slowly. The 10.2.1 Geometry method I mentioned above is much faster. Let me know if this doesn't answer your question or if I can provide any further assistance.
... View more
03-04-2014
06:44 AM
|
0
|
0
|
3108
|
|
POST
|
Hi Ada. After you've created your network dataset, what's the goal of your analysis? Do you want to calculate pedestrian travel time from one point to another? Do you want to compare that to drive time? The way you set up your network attributes should depend on what you're hoping to analyze. I'm guessing you probably don't want to create an attribute that uses either walk time OR drive time on the streets. You probably want to use separate attributes for these, like you have it set up now. When someone is driving, they could conceivably park and then get on a train or bus, but they're not going to be able to continue driving when they get off the train or bus because they've left their car at the other end of their journey. So, you're going to want one impedance attribute where the street evaluators are set up for walking and the bus and train ones are set up for bus/train time. You'll want a second one where the street evaluators are set up for road speeds and the bus/train ones are never used (because this is a purely drive-time analysis). You can use a constant evaluator and set it to -1 to make train/bus edges never used. Your logic for calculating travel speed in your evaluators looks correct, as long as the units of your cost attribute and the other attributes you're using in your functions are correct. It's all just basic unit conversions.
... View more
03-04-2014
06:25 AM
|
0
|
0
|
1546
|
|
POST
|
This video has a demonstration showing essentially what you're trying to do. http://video.esri.com/watch/2918/network-analyst-performing-network-analysis The relevant part starts around 12:50, and the field mapping portion starts around 16:30. The demo finished up around 19:40.
... View more
02-27-2014
02:14 PM
|
0
|
0
|
1487
|
|
POST
|
After you create a new Route layer, you have to first load locations (stops) before you can solve the Route. Essentially, you have to tell the Route layer what points you're creating a route for. So, you use the Load Locations tool (or Add Locations if you're using ArcToolbox or writing a python script or making a model). When you load locations, you can do something called field mapping. This determines the relationship between fields in the input data (your people and parks) and the class in the Route layer you're loading (Stops). The Stops class has a field called Name, and you can indicate that the field "ParkName" in your parks input should be transferred to the Name field in Stops. To read more about field mapping and the Load Locations tool, check out this page: http://resources.arcgis.com/en/help/main/10.2/index.html#//00470000003t000000. You can use field mapping to produce the behavior you're looking for (to create a separate route between individual pairs of stops). When you load your people and your parks into the Stops class, you can assign each person and park to a different route using the RouteName field. Stops with the same RouteName will have a route generated between them. If your Stops class contains stops with 10 different RouteNames, 10 individual routes will be created in the results. So, to do what you're trying to do, you should give each person-park pair a unique ID that will be used as the RouteName: RouteName, Participant, Park Route_A, 1, X Route_B, 2, Y Route_C, 3, Z Route_D, 4, Y This is why you might have to load multiple copies of some parks. If multiple people use the same park, you'll need a copy of that park for each person who used it.
... View more
02-27-2014
01:52 PM
|
0
|
0
|
1487
|
|
POST
|
Yes! To do this, you need to use field mapping when you do Load Locations (or Add Locations from python). You need to map your input data's break value field to the Breaks_[ImpedanceAttribute] field in your Service Area Facilities layer. Each one will get its own break value that way. The break values option on the layer properties will be used only if a facility doesn't have its own in the table. In other words, the values in the table override the default value on the layer properties, which is just what you want. You can read more about field mapping here: http://resources.arcgis.com/en/help/main/10.2/index.html#//00470000003t000000
... View more
02-18-2014
06:34 AM
|
0
|
0
|
601
|
|
POST
|
Oh, now I understand your question. You want a way to relate the input Incidents or Facilities back to the original data you loaded in. Got it. When you're loading your data as Incidents or Facilities using Load Locations, you can use the Field Mapping controls to retain some of the fields from the original data. You could map a unique ID field in your input data to the Name field in Incidents or Facilities. If you want to retain several fields from your input data, you can use the Add Field To Analysis Layer tool to create new fields in Incidents and Facilities. Then, after creating those fields, you can run Load Locations and use the Field Mapping control to map the correct fields from the input data. More information about field mapping can be found here: http://resources.arcgis.com/en/help/main/10.2/index.html#//00470000003t000000
... View more
02-14-2014
06:23 AM
|
0
|
0
|
853
|
|
POST
|
Hi. You can use the Route solver. You can configure it to solve multiple routes, one for each person-park pair. To do this, you need to use field mapping when you're loading locations into the Route layer. Each person-park pair should have a unique ID, and you should map this unique ID to the Route layer's RouteID field. You might have to load multiple copies of the same park because multiple people use the same park.
... View more
02-14-2014
06:18 AM
|
0
|
0
|
1487
|
|
POST
|
Hi Marco. In the output Routes class of Closest Facility, the FacilityID field can be joined to the ObjectID field in Facilities, and the IncidentID field can be joined to the ObjectID field of Incidents.
... View more
02-13-2014
06:27 AM
|
0
|
0
|
853
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-14-2025 08:00 AM | |
| 1 | 09-03-2025 09:18 AM | |
| 1 | 08-22-2025 07:14 AM | |
| 2 | 08-07-2025 07:06 AM | |
| 2 | 06-13-2025 07:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|