Last active
January 27, 2024 11:23
-
-
Save napo/dfb80d0d0e31d8195ed8bd73d6d9c1f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
import json | |
file_url = 'https://api.datawrapper.de/v3/basemaps/rome-zip' | |
file_json = "rome.json" | |
file_output = "rome.topojson" | |
urllib.request.urlretrieve(file_url ,file_json) | |
with open(file_json, 'r') as f: | |
json_data = json.load(f) | |
topojson = dict(json_data["content"]) | |
with open(file_output, 'w') as f: | |
json.dump(topojson, f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
a simple script to extract the topojson from the datawrapper API
In the example the zip codes geometries of Rome