fixed refiner
This commit is contained in:
parent
34922a2645
commit
fd378d6289
@ -128,10 +128,16 @@ def remove_duplicates(L: List[Landmark]) -> List[Landmark] :
|
|||||||
for landmark in L :
|
for landmark in L :
|
||||||
if landmark.name in names and landmark.location in coords:
|
if landmark.name in names and landmark.location in coords:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
approx_coords = tuple((round(landmark.location[0], 4), round(landmark.location[0], 4)))
|
||||||
|
|
||||||
|
if approx_coords in coords :
|
||||||
|
continue
|
||||||
|
|
||||||
else :
|
else :
|
||||||
names.append(landmark.name)
|
names.append(landmark.name)
|
||||||
L_clean.append(landmark)
|
L_clean.append(landmark)
|
||||||
coords.append(tuple((round(landmark.location[0], 3), round(landmark.location[0], 3))))
|
coords.append(approx_coords)
|
||||||
|
|
||||||
return L_clean
|
return L_clean
|
||||||
|
|
||||||
@ -247,6 +253,10 @@ def get_landmarks(list_amenity: list, landmarktype: LandmarkType, city_country:
|
|||||||
if 'disused:leisure' in elem.tags().keys():
|
if 'disused:leisure' in elem.tags().keys():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# skip if part of another building
|
||||||
|
if 'building:part' in elem.tags().keys() and elem.tag('building:part') == 'yes':
|
||||||
|
continue
|
||||||
|
|
||||||
else :
|
else :
|
||||||
osm_type = elem.type() # Add type : 'way' or 'relation'
|
osm_type = elem.type() # Add type : 'way' or 'relation'
|
||||||
osm_id = elem.id() # Add OSM id
|
osm_id = elem.id() # Add OSM id
|
||||||
|
@ -3,6 +3,7 @@ from typing import List
|
|||||||
from math import pi
|
from math import pi
|
||||||
|
|
||||||
from structs.landmarks import Landmark
|
from structs.landmarks import Landmark
|
||||||
|
from landmarks_manager import take_most_important
|
||||||
|
|
||||||
|
|
||||||
def create_corridor(landmarks: List[Landmark], width: float) :
|
def create_corridor(landmarks: List[Landmark], width: float) :
|
||||||
@ -25,15 +26,6 @@ def create_linestring(landmarks: List[Landmark])->List[Point] :
|
|||||||
return LineString(points)
|
return LineString(points)
|
||||||
|
|
||||||
|
|
||||||
"""def is_in_area_ring(area: Polygon, coordinates) -> bool :
|
|
||||||
|
|
||||||
point = Point(coordinates)
|
|
||||||
if area.contains(point) :
|
|
||||||
t = area.interiors[0]
|
|
||||||
return not t.contains(point)
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def is_in_area(area: Polygon, coordinates) -> bool :
|
def is_in_area(area: Polygon, coordinates) -> bool :
|
||||||
|
|
||||||
point = Point(coordinates)
|
point = Point(coordinates)
|
||||||
@ -48,4 +40,4 @@ def get_minor_landmarks(all_landmarks: List[Landmark], visited_landmarks: List[L
|
|||||||
if is_in_area(area, landmark.location) and landmark not in visited_landmarks:
|
if is_in_area(area, landmark.location) and landmark not in visited_landmarks:
|
||||||
second_order_landmarks.append(landmark)
|
second_order_landmarks.append(landmark)
|
||||||
|
|
||||||
return second_order_landmarks
|
return take_most_important(second_order_landmarks)
|
@ -105,13 +105,12 @@ def test4(coordinates: tuple[float, float]) -> List[Landmark]:
|
|||||||
#write_data(minor_landmarks, 'minor_landmarks.txt')
|
#write_data(minor_landmarks, 'minor_landmarks.txt')
|
||||||
print("There are " + str(len(minor_landmarks)) + " minor landmarks around the predicted path")
|
print("There are " + str(len(minor_landmarks)) + " minor landmarks around the predicted path")
|
||||||
|
|
||||||
|
full_set = visited_list[:-1] + minor_landmarks[:30]
|
||||||
|
full_set.append(finish)
|
||||||
|
|
||||||
fuller_list = minor_landmarks + visited_list
|
new_route = solve_optimization(full_set, max_walking_time*60+detour, True)
|
||||||
|
|
||||||
new_visit = solve_optimization(fuller_list, max_walking_time*60+detour, True)
|
return new_route
|
||||||
|
|
||||||
|
|
||||||
return visited_list
|
|
||||||
|
|
||||||
|
|
||||||
test4(tuple((48.8795156, 2.3660204)))
|
test4(tuple((48.8795156, 2.3660204)))
|
||||||
|
12256
landmarks.txt
12256
landmarks.txt
File diff suppressed because it is too large
Load Diff
1002
minor_landmarks.txt
1002
minor_landmarks.txt
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user