21 lines
582 B
Python
21 lines
582 B
Python
import overpass
|
|
import json
|
|
|
|
api = overpass.API()
|
|
|
|
res = api.get("""
|
|
area[name="Florida"];
|
|
rel[name="Sumter County"](area);
|
|
map_to_area;
|
|
(
|
|
nwr[highway~"^(motorway|trunk|primary|secondary|tertiary|residential|unclassified|motorway_link|trunk_link|primary_link|secondary_link|tertiary_link)$"](area);
|
|
);
|
|
(._;>;);
|
|
""", responseformat="geojson")
|
|
|
|
# if you want a str, then use dumps function
|
|
#geojson_str = geojson.dumps(res)
|
|
|
|
# dump as file, if you want to save it in file
|
|
with open("./test.geojson",mode="w") as f:
|
|
json.dump(res, f) |