In designing a routing tool, I'm attempting to minimize the amount of surface streets (non-motorways) needed to reach the closest facilities. The only options available in Network Analyst are snap to closest feature or snap to first feature (within some tolerance radius) when using the AddLocations tool.
As you can see from the image below, the code will snap the input location via part 1 every time (either by closest or by first). The favorable direction is to snap via path 2 to avoid that southern loop.
Does anyone have any ideas of how to route using part 2?
(Note: The Network dataset shown below is from OpenStreetMap and prohibits travel on motorways and motorway links. All the remaining roadways are to be treated equally in this scenario.)
then you will have to devise your rules and use Jay's solution. I have seen mine work when the point is actually just representing the centroid of a shopping mall so its actual location is not relevant...moving the point gives it a preferential location given that the option would be to add routes into the shopping mall and incorporate those into the network as well. The latter approach would only be worthwhile if you were considering routing for paratranspo services that may need information for multi-entrance malls. So you have many options, depending on how critical any time differences are.
You can have more control on where a location is snapped by adding some logic to the snapping. See the section titled "Snapping environment with Build Query" here:
Also you can calculate one of the Attr_ fields on the input stops for additional cost to be added to the route. The Attr_ field should correspond to the cost attribute your are solving on and in the same units. You can read more on them in the Stop Properties section here:
The build query achieves the same thing as my restriction does already. As I mentioned, the remaining roads are all valid routes.
Pre-adding snapping distance as a cost doesn't solve the issue since the snapping distance is part of the total cost variable.