Crosswalks' crossing distance calculation
The process that we follow in order to calculate the crossing distance of a crosswalk depends mainly on the object detection model, as we use the crosswalks' bounding boxes and other elements. For this purpose, we have defined several steps ranging from a precise calculation using ADAcurbmats, to an estimation using directly the crosswalk’s bounding box diagonal.
If the conditions are met, we will use the most precise method; otherwise, we will check the conditions of the other methods to check if we can use any. If that is not the case, we will use the generic method that works on any crosswalk, but lacks precision, which is the bounding box diagonal method.
For getting every crosswalk’s crossing distance, we go through all of them and apply a 2.8 meter buffer to their bounding boxes. After applying the buffer, we get the ADAcurbmats that lie within the buffered bounding box and store them in a list, which is going to be used in the following methods:
ADAcurbmat to ADAcurbmat method:
If the number of ADAcurbmats within the bounding box is more or equal than 2, we get the 2 nearest ADAcurbmats that are separated by more than 5.4 meters, which are the points that build up our crossing line in that specific crosswalk.
ADAcurbmat to center method:
If the bounding box contains only one ADAcurbmat, we build a line that passes through its location and the center of the bounding box, and we compute the intersection of this line with the bounding box itself, resulting in our desired crossing line.
Perpendicular line through center method:
In case we don’t have any ADAcurbmats within the bounding box, we check the OSM roads in that specific zone, if these roads intersect with the crosswalk’s bounding box, we compute the perpendicular line to the nearest OSM road LineString (nearest to the center of the bounding box) that passes through the center of the bounding box and then the intersection with the bounding box (same process as the previous method), resulting in the crossing line.
Bounding box diagonal method:
Lastly, if the are no ADAcurbmats and no OSM road geometries intersect with the bounding box, we just take the diagonal of the bounding box as our crossing line.