Skip to content
Snippets Groups Projects
Commit 4c70fcf1 authored by Léna Aix's avatar Léna Aix
Browse files

ajout module coord_inter

parent 2de3317b
No related branches found
No related tags found
No related merge requests found
def coord_to_inter(liste_coord,lat,long,main_street):
dist=[]
inter_street=[]
for inter in liste_coord:
d=(inter[0]-long)**2 + (inter[1]-lat)**2
dist.append(d)
while len(inter)<1 :
candidat=liste_coord[dist.index(min(dist))]
nom_de_rue=circular_research(candidat[1], candidat[0], main_street)
if nom_de_rue== None :
indice=dist.index(min(dist))
dist.pop(indice)
liste_coord.pop(indice)
else :
inter_street.append(nom_de_rue)
indice=dist.index(min(dist))
dist.pop(indice)
liste_coord.pop(indice)
while len(inter)<2 :
candidat=liste_coord[dist.index(min(dist))]
dist_1_2= (candidat[0]-inter_street[0][0])**2 + (candidat[1]-inter_street[0][1])**2
dist_main_2= min(dist)
if dist_1_2<dist_main_2 :
indice=dist.index(min(dist))
dist.pop(indice)
liste_coord.pop(indice)
else:
nom_de_rue=circular_research(candidat[1], candidat[0], main_street)
if nom_de_rue== None :
indice=dist.index(min(dist))
dist.pop(indice)
liste_coord.pop(indice)
else :
inter_street.append(nom_de_rue)
indice=dist.index(min(dist))
dist.pop(indice)
liste_coord.pop(indice)
return inter_street
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment