mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-11-16 15:01:44 +01:00
More balanced approach
to centroid vs pole of inaccessability
This commit is contained in:
parent
5aa211e120
commit
9c5782e6c8
1 changed files with 2 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
From https://github.com/Twista/python-polylabel/,
|
From https://github.com/Twista/python-polylabel/,
|
||||||
which is in turn implemented from https://github.com/mapbox/polylabel
|
which is in turn implemented from https://github.com/mapbox/polylabel
|
||||||
"""
|
"""
|
||||||
from math import sqrt
|
from math import sqrt, log10
|
||||||
import time
|
import time
|
||||||
from typing import Tuple, List
|
from typing import Tuple, List
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ def polylabel(polygon: Polygon, precision: float=0.5, debug: bool=False):
|
||||||
while not cell_queue.empty():
|
while not cell_queue.empty():
|
||||||
_, __, cell = cell_queue.get()
|
_, __, cell = cell_queue.get()
|
||||||
|
|
||||||
if cell.min_dist > best_cell.min_dist or (cell.center_dist < best_cell.center_dist and cell.min_dist > best_cell.min_dist - 0.5):
|
if cell.min_dist > best_cell.min_dist or (cell.center_dist < best_cell.center_dist and cell.min_dist > best_cell.min_dist - log10(cell_size) / 2.0):
|
||||||
best_cell = cell
|
best_cell = cell
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
|
|
Loading…
Reference in a new issue