Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions common.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
import projection


def is_in(area, lon, lat):
x_u, y_u, x_l, y_l = area
if lat <= y_u and lat >= y_l and lon >= x_u and lon <= x_l:
return True
return False


def list_crawl(url, match):
charts = []
html_page = urllib.request.urlopen(url)
Expand Down Expand Up @@ -126,11 +119,15 @@ def zip_charts(list_of_all_tiles, chart):
y_tile = int(tokens[len(tokens) - 1].split(".")[0])
x_tile = int(tokens[len(tokens) - 2])
z_tile = int(tokens[len(tokens) - 3])
lon_tile, lat_tile, lon1_tile, lat1_tile = projection.findBounds(x_tile, y_tile, z_tile)
lon_min, lat_max, lon_max, lat_min = projection.findBounds(x_tile, y_tile, z_tile)

# include zoom 7 and below in every chart
for count in range(len(regions)):
if is_in(region_coordinates[count], lon_tile, lat_tile) or z_tile <= 7:
region_lon_min, region_lat_max, region_lon_max, region_lat_min = region_coordinates[count]
# Check if tile overlaps region anywhere
lon_overlap = lon_max >= region_lon_min and lon_min <= region_lon_max
lat_overlap = lat_max >= region_lat_min and lat_min <= region_lat_max
if (lon_overlap and lat_overlap) or z_tile <= 7:
zip_files[count].write(tile)
manifest_files[count].write(tile + "\n")

Expand Down