MCPcopy Create free account
hub / github.com/comaps/comaps / add_missing_zooms

Function add_missing_zooms

tools/python/stylesheet/drules_merge.py:39–54  ·  view source on GitHub ↗

Checks zoom ranges for source and target, and appends as much sources to the dest as needed.

(dest, typ, source, target, high)

Source from the content-addressed store, hash-verified

37 return "zoom {}".format(z1)
38
39def add_missing_zooms(dest, typ, source, target, high):
40 """Checks zoom ranges for source and target, and appends as much sources to
41 the dest as needed."""
42 if high:
43 scales = (target.scale + 1, source.scale + 1)
44 else:
45 scales = (source.scale, target.scale)
46
47 if scales[1] < scales[0]:
48 print("{}: missing {} {}".format(typ, 'high' if high else 'low', zooms_string(scales[1], scales[0] - 1)))
49 for z in range(scales[1], scales[0]):
50 fix = copy.deepcopy(source)
51 fix.scale = z
52 dest[typ].append(fix)
53 elif scales[1] > scales[0]:
54 print("{}: extra {} {}".format(typ, 'high' if high else 'low', zooms_string(scales[0], scales[1] - 1)))
55
56def create_diff(zooms1, zooms2):
57 """Calculates difference between zoom dicts, and returns a tuple:

Callers 1

create_diffFunction · 0.85

Calls 3

zooms_stringFunction · 0.85
formatMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected