forked from microsoft/temporal-cluster-matching
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.py
48 lines (40 loc) · 1.58 KB
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import start_server
import time
import datetime
import multiprocessing as mp
# from temporal_cluster_matching import utils, DataInterface
start_time = time.time()
print("Starting algorithm at %s" % (str(datetime.datetime.now())))
##############################
# Ensure output directory exists; if a CSV exists already, indicate code to pick up where we left off
##############################
# index_done = []
# if os.path.exists(args.output_dir):
# # see if csv exists within directory
# if os.path.exists(os.path.join(args.output_dir, "results.csv")):
# results = pd.read_csv(os.path.join(args.output_dir, "results.csv"))
# index_done = results.iloc[:, 0].tolist()
# index_done = [str(i) for i in index_done]
# else:
# os.makedirs(args.output_dir, exist_ok=False)
#
# output_fn = os.path.join(
# args.output_dir,
# "results.csv"
# )
##############################
# Load geoms / create dataloader
##############################
# if not os.path.exists(args.dataset):
# print("Dataset doesn't exist. It's likely that there just aren't any structures in this county.")
# return
# geoms = utils.get_all_geoms_from_file1('../all_buildings/data/input/OSM/san_jose_test.geojson', [])
# dataloader = DataInterface.NAIPDataLoader()
manager = start_server.RtreeManager(address=('localhost', 50000), authkey=b'')
manager.connect()
# manager = rtree.index.Index('tiles/tile_index')
nprocs = mp.cpu_count()
print(nprocs)
result = manager.intersection((-121.9397863207285, 37.36443486181571, -121.9397863207285, 37.36443486181571))
# print(type(result))
print(result)