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
|
1102
|
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
|
572
|
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
|
1102
|
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
|
584
|
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
|
584
|
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
|
1102
|
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
|
584
|
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
|
572
|
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
|
572
|
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
|
264
|
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
|
385
|
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
|
572
|
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
|
385
|
POST
|
A good first step would be to run through the Network Analyst tutorials, available here: http://resources.arcgis.com/en/help/main/10.2/index.html#//00470000005r000000. They will show you how to incorporate your StreetMaps Premium data and set up a Route or other analysis. Post again if you have further questions.
... View more
02-03-2014
06:12 AM
|
0
|
0
|
188
|
POST
|
Hi Andreas. Yes, it looks like that executable just does some stuff you could write yourself in python without too much trouble. You just have to grab the output OD Lines, run a search cursor, and print each row to the CSV file using python's simple csv module. Or, you can just continue using that executable. I think it would still work with multiprocessing. Also, before you continue, please note that multiprocessing isn't going to help you much if your machine has only 2 cores or something, so think about that before spending a lot of time on this. Here's a little outline script showing how you can set up multiprocessing. Let me know if this isn't clear or you need more detail. import multiprocessing
import csv
import arcpy
def CalculateOD(stuffPassed):
'''Calculate the OD matrix and write the results to a CSV'''
## Generate the input layer. You can read in a saved layer template
## add add the appropriate origins and destinations for this chunk
## Solve the layer
## Call the external Save-to-CSV code or write your own code
## Return the path to the CSV
# ---- Main code ----
def main():
## Do whatever you need to prepare your analysis
ODChunks = []
## Fill your list of OD chunks somehow
# Pass this info as inputs to the multiprocessing function.
stuffToPass = []
for chunk in ODChunks:
if chunk:
idx = ODChunks.index(chunk)
# I'm passing the chunk index because you can use that to name the output file
stuffToPass.append([chunk, idx, OTHERVARIABLES])
# Do the multiprocessing. It could return the paths to the output csvs if you want.
pool = multiprocessing.Pool()
OutCSVs = pool.map(CalculateOD, stuffToPass)
pool.close()
pool.join()
# Combine the output csvs
for CSVFile in OutCSVs:
## Open each CSV using python's csv module
## The first line is probably the field headers, so discard that after the first time
## Dump the rows out into one giant table.
if __name__ == '__main__':
main() Note: You can't execute a multiprocessed code like this from within a python IDE. You have to run it from a command line. Also, you have to have the if __name__ == '__main__': syntax with the main() function.
... View more
01-27-2014
10:46 AM
|
0
|
0
|
371
|
Title | Kudos | Posted |
---|---|---|
1 | a week ago | |
1 | 03-08-2024 09:59 AM | |
1 | 02-14-2024 02:21 PM | |
1 | 02-20-2024 06:54 AM | |
1 | 02-16-2024 03:41 PM |
Online Status |
Offline
|
Date Last Visited |
yesterday
|