remove keys

This commit is contained in:
Zsolt Ero
2023-12-27 22:06:08 +01:00
parent 130cc7f4d1
commit cef6e9c4ae

View File

@@ -35,6 +35,8 @@ def cli(styles_folder):
print(f'formatting {style_file}')
remove_keys(style_file)
# gl-style-migrate
p = subprocess.run(
[node_bin_path / 'gl-style-migrate', style_file], capture_output=True, text=True
@@ -64,5 +66,16 @@ def cli(styles_folder):
)
def remove_keys(style_file):
with open(style_file) as fp:
data = json.load(fp)
for key in ['id', 'center', 'zoom', 'bearing', 'pitch']:
data.pop(key, None)
with open(style_file, 'w') as fp:
json.dump(data, fp, ensure_ascii=False)
if __name__ == '__main__':
cli()