barefootstache<p>This uses <a href="https://qoto.org/tags/TurfJs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>TurfJs</span></a> polygon length function to calculate its circumference. The underlying sorting of the coordinates uses polar coordinates, since that is how they are being randomly generated. By first sorting over the degrees and the distances.</p><p>For most instances this is a pretty good estimate, though in some case a self-intersecting polygon can be created, which hints that there is a more optimized polygon.</p><p>Further this problem is a typical 'travelling salesman problem' which can be solved via various algorithms.</p><p>Though before considering such optimization issues, there is the main question if the randomly generated POI is even accessible to the public. </p><p>In the case one is a pedestrian, one could use <a href="https://qoto.org/tags/overpass" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>overpass</span></a> to gather information if any <a href="https://qoto.org/tags/OpenStreetMap" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>OpenStreetMap</span></a> highways exist in the proximity to the POI and then find the one that is the closest and permissive to pedestrians. Then move the POI to that location.</p><p>This example only works if there is enough <a href="https://qoto.org/tags/OSM" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>OSM</span></a> data at the location.</p><p><a href="https://qoto.org/tags/mathematics" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mathematics</span></a> <a href="https://qoto.org/tags/maths" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>maths</span></a></p>