Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Created July 30, 2021 13:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
import json
import os
import requests
dir_path = os.path.dirname(os.path.realpath(__file__))
r_roads = requests.get('https://omnesviae.org/roads.php')
r_all = requests.get('https://omnesviae.org/all.php')
features_roads = {
"type": "FeatureCollection",
"features": []
}
for road in r_roads.json()['roads']:
features_roads["features"].append({
"type": "Feature",
"properties": {
"kind": road["kind"]
},
"geometry": {
"type": "LineString",
"coordinates": [list(reversed(coord)) for coord in road['points']]
}
})
with open(os.path.join(dir_path, 'roads.geojson'), 'w') as outfile:
json.dump(features_roads, outfile)
features_markers = {
"type": "FeatureCollection",
"features": []
}
for pt in r_all.json()['markers']:
features_markers["features"].append({
"type": "Feature",
"properties": {
"id": pt[5],
"name": pt[0],
"desc": pt[1],
"source": "Tabula Peutingeriana" if pt[5][0] == "T" else "Itinerarium Antonini"
},
"geometry": {
"type": "Point",
"coordinates": [pt[4], pt[3]]
}
})
with open(os.path.join(dir_path, 'points.geojson'), 'w') as outfile:
json.dump(features_markers, outfile)
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment