Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Created July 30, 2021 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThomasG77/003d087ad317bf871eabd0fb77a719eb to your computer and use it in GitHub Desktop.
Save ThomasG77/003d087ad317bf871eabd0fb77a719eb to your computer and use it in GitHub Desktop.
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