Last week, we covered how to assign service area districts using drivetime polygons. At the end of the article, I did allude to a potential problem: Very small overlaps. Does it make sense to assign an area to a service engineer if the drivetime only overlaps 1% of the area? 5%? 10%?
Can we agree that just barely reaching the area within 15 minutes, corresponding to a 15-minute drivetime polygon overlapping the area with just a few percent, doesn't really mean that this area should be assigned to that service engineer? If we can, how do we prevent this from happening?
On a map, it would look like this:
Does the orange drivetime polygon really cover the selected area?
I think we can agree that the drivetime regions should overlap the area to a certain extent before we consider the area covered. This would mean that we need to measure this extent and condition it in our query.
Luckily, that can be done easily. We already calculate this value, we just need to add it to our conditions.
Here's a reminder of last week's query, which I'll tweak slightly further down:
Select sa.postsect, sa.NameNew, sa.DistanceNew
, dt.NAME, dt.value, ProportionOverlap(sa.Obj, dt.Obj) As "PropOverlap"
From Service_Areas As "sa", Service_Engineers_overlap_DT As "dt"
Where sa.Obj intersects dt.Obj
And dt.value= nValue
And sa.DistanceNew = 0
Order by sa.postsect, PropOverlap Desc
Into _to_update
Update _to_update
Set NameNew = Name,
DistanceNew = value
It does calculate the Proportional Overlap, but we only use it to sort the result. In an improved query, we also add this to the conditions and compare it to a reasonable overlap. In my example below, I expect the area to be covered by 50% or more (And ProportionOverlap(sa.Obj, dt.Obj) >= 0.5) before I assign the area to that service engineer. In your case, the overlap percentage may differ. Maybe 25% (0.25) or 75% (0.75) works better for your situation. Sometimes, you may have to try a couple of values to see which makes the most sense.
I have added a PropOverlap column to my Service_Area table. This column is updated with the overlap percentage in the Update statement. This helps me verify the result. I check these values to ensure they are above the specified tolerance. I also checked the temporary table _to_update after I ran the script. This is especially worth checking at higher distance values, where more drivetime polygons overlap the areas simultaneously.
Here is the adjusted query:
Select sa.postsect, sa.NameNew, sa.DistanceNew
, sa.PropOverlap, dt.NAME, dt.value
, ProportionOverlap(sa.Obj, dt.Obj) As "PropOverlapNew"
From Service_Areas As "sa", Service_Engineers_overlap_DT As "dt"
Where sa.Obj intersects dt.Obj
And dt.value= nValue
And sa.DistanceNew = 0
And ProportionOverlap(sa.Obj, dt.Obj) >= 0.5
Order by sa.postsect, PropOverlapNew Desc
Into _to_update
Update _to_update
Set NameNew = Name,
DistanceNew = value,
PropOverlap = PropOverlapNew
The nValue is still a variable that the user enters when the script runs. This allows the script to be used for various drivetime distances.
Let's run it for the 15-minute drivetime polygons.
As I mentioned above, the user will be prompted to enter the drivetime distance
The result after running for the 15-minute drivetime polygons.
And for 30-minute drivetime polygons
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
------------------------------