id author title date pages extension mime words sentences flesch summary cache txt github-com-6917 public_library_map/merge_service_data.py at 31550bb512ceecb5dc5a16d2050044753ee4d878 · hughrun/public_library_map · GitHub .html text/html 451 101 76 public_library_map/merge_service_data.py at 31550bb512ceecb5dc5a16d2050044753ee4d878 · hughrun/public_library_map · GitHub Explore GitHub → GitHub Education → GitHub Stars program → public_library_map/merge_service_data.py Code definitions No definitions found in this file. # files to merge geojson_file = 'website/data/all_library_services.geojson' csv_file = 'website/data/library_services_information.csv' geojson_match = 'name' output_file = 'website/data/boundaries.geojson' # open the geojson file # read the file and then load the json so it's a dict json_data = json.loads(file.read()) # for each geojson feature, if a field in the json matches a field in the csv, add new properties to the json with open(csv_file, newline='') as f: reader = csv.DictReader(f) if row[csv_match] == feature['properties'][geojson_match]: # create new properties in geojson feature['properties'][k] = row[k] downcased = titlecase(feature['properties'][geojson_match]) # titlecase name feature['properties']['name'] = downcased # write out new geojson file with the updates with open(output_file, 'w') as newfile: Copy lines Copy permalink © 2021 GitHub, Inc. © 2021 GitHub, Inc. Contact GitHub You can't perform that action at this time. ./cache/github-com-6917.html ./txt/github-com-6917.txt