This commit is contained in:
2024-11-03 20:17:41 +03:00
commit 1c2772316e
13 changed files with 66666 additions and 0 deletions

18
main_delete_full.py Normal file
View File

@@ -0,0 +1,18 @@
import json
# Чтение данных из файла
with open('russia.geojson', 'r', encoding='utf-8') as infile:
data = json.load(infile)
# Поля, которые нужно оставить
fields_to_keep = ['id', 'name', 'full_name', 'major_cities', '_cartodb_id0', 'cartodb_id']
# Обновляем свойства в каждом объекте features
for feature in data['features']:
feature['properties'] = {key: feature['properties'][key] for key in fields_to_keep if key in feature['properties']}
# Запись резФультата в новый файл
with open('russia_2.geojson', 'w', encoding='utf-8') as outfile:
json.dump(data, outfile, ensure_ascii=False, separators=(',', ':'))
print("Обработка завершена. Результат записан в output.json.")