Skip to content
Snippets Groups Projects
Commit 2c67e991 authored by Alexandre Pradeilles's avatar Alexandre Pradeilles
Browse files

read me

parents 47da009d 84bb5d91
No related branches found
No related tags found
1 merge request!1Sansdocker
from request import requete_osm
from math import sqrt, sin, cos, pi
from concurrent.futures import ThreadPoolExecutor
import time
def circular_research(lat, lon, main_street):
......@@ -90,29 +89,11 @@ def check_position(lat, lon, step, main_street, i):
return street
def multi_position(lat, lon, step):
#test de multrithreading mais cela n'améliore pas énormément la vitesse de calcul
#donc pas utilisé finalement
latitude = []
longitude = []
for j in range(1,4):
stp = j*step
for i in range(8):
latitude.append(lat+stp*cos(i*2*pi/8))
longitude.append(lon+stp*sin(i*2*pi/8))
with ThreadPoolExecutor(max_workers=30) as executor:
streets = executor.map(requete_osm, latitude, longitude)
executor.shutdown(wait=True)
return streets
if __name__=="__main__":
lat = 48.89494122
lon = 2.247959188
step = 10**(-5)
main_street = 'Avenue Gambetta'
t1 = time.time()
streets = multi_position(48.89494122, 2.247959188, 10**(-5))
t2 = time.time()
#print(len(list(streets)))
print(t2-t1)
t1 = time.time()
......@@ -122,5 +103,3 @@ if __name__=="__main__":
check_position(lat, lon, stp, main_street, i)
t2 = time.time()
print(t2-t1)
\ 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