Skip to content
Snippets Groups Projects
Commit a5cd0aa4 authored by Hoa Ben The Nguyen's avatar Hoa Ben The Nguyen
Browse files

add: calculation for subID and groupID

parent 1bc72c15
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,9 @@ def define_gridareas(lat, lng, area_offset, grid_size):
# find subareas size relative to main area
subarea_offset = area_offset/grid_size
print(main_area)
group_id = 0
i=0
j=0
# find the center coordinates of each area in grid to find the corner areas
for y in (range(grid_size)):
......@@ -55,10 +57,17 @@ def define_gridareas(lat, lng, area_offset, grid_size):
lat_pos = main_area[3][0] + relative_size_lat * area_size[0] + dist_to_subcenter[0]
lng_pos = main_area[3][1] + relative_size_lng * area_size[1] + dist_to_subcenter[1]
# id of each subarea
sub_id = x % grid_size + grid_size*y
sub_id = x % grid_size + grid_size * y
if (x+(y*grid_size)) % ((grid_size*2) + 1) == grid_size * 2:
group_id += 2
if (x+(y*grid_size)) % 2 == 0 and (x+(y*grid_size)) != 0:
i += 1
# use the center of sub areas to find the corner of each subarea
corners = calculate_corners(lat_pos, lng_pos, subarea_offset)
grided_area.append((sub_id, corners))
grided_area.append((sub_id, group_id + i%2, corners))
return grided_area
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment