Stop point load from snapping across a barrier

282
3
02-13-2023 06:31 PM
HarrySmiles
New Contributor III

I am currently working on a modelled fastest 20 fire fighting appliances into predetermined assignment areas (aa). The process I'm using is to create a centroid for each aa, then to load these as a destinations in an OD Matrix, with Fire Stations as the origin points. 

The issue I'm getting is that the centroid is quite a few cases is snapping a road outside of the aa. In the example below the centroid in the pink point, and the location it has snapped to is the red point. I would like it to instead snap to the closest road that is within the aa.

HarrySmiles_0-1676341731172.png

I have tried loading in the AAs as a polygon barrier but when I do this, none of the centroids will match. Any ideas if there is a solution to this?

TIA

 

0 Kudos
3 Replies
MelindaMorang
Esri Regular Contributor

Hello Harry.

I think the first thing you should consider is whether using a centroid in your analysis is really the best way to go.  If you have large, irregular polygons like the one shown in the screenshot, the centroid (or the network location it snaps to) may not be a good representation of reality.  You could instead, for instance, choose the midpoint of a main road in the area or the location of the most populated building.

To answer your question, you may have some success using a search query when loading inputs.  You could first run a Calculate Field on your streets to label each one with the aa it falls in (or None, if it doesn't fall in one).  When you run Add Locations (or however you're loading inputs), you can set up a search query so that each input only snaps to roads with the designated aa value.  Note that the search query applies to all points loaded in a given run of the tool, so you might have to run it separately for each aa so you can tailor the query to each one.  You might be able to preprocess that snapping in a more efficient way (not sure off the top of my head) and then just run Add Locations once.

This documentation might be helpful.

0 Kudos
HarrySmiles
New Contributor III

Thanks Melinda,

I'm certainly not a fan of the centroid option for this. We have a primary process were we look at the average time to cover all the roads in the AA, but that approach isn't feasible in the timeframe I have to process the data as I would need to run 5hr service areas for 1500 locations. My other idea was to do similar to your idea, but I would need to find that point programmatically as there are about 6000 AAs that I need to process.

As a fall back to the centroids,  the loading individually may work, but again I may run into time constraints. I'll look into it though. 

Thanks

 

0 Kudos
MelindaMorang
Esri Regular Contributor

You might be able to simplify the query a little.  Just calculate a field to a value of 1 (for example) if the street falls within any AA, and then constrain the locating to only locate on streets with that value.  It won't guarantee that the point locates within the correct AA, but hopefully in most cases some usable street within the AA is closer than the nearest street in a different AA.

0 Kudos