mirror of
https://codeberg.org/matkoniecz/list_how_openstreetmap_can_be_improved_with_alltheplaces_data.git
synced 2025-04-11 10:09:29 +02:00
first step to view data across time
This commit is contained in:
parent
73cca0d9a5
commit
b8309e686a
1 changed files with 50 additions and 0 deletions
|
@ -1,7 +1,57 @@
|
|||
import rich
|
||||
import osm_bot_abstraction_layer.util_download_file
|
||||
import os
|
||||
import json
|
||||
|
||||
config = __import__("0_config")
|
||||
obtain_atp_data = __import__("2_obtain_atp_data")
|
||||
|
||||
def download():
|
||||
for entry in obtain_atp_data.get_atp_history()[::-1]:
|
||||
run_id = entry['run_id']
|
||||
print(run_id)
|
||||
obtain_atp_data.download_specific_atp_run(run_id)
|
||||
|
||||
|
||||
|
||||
def relevant_one(feature):
|
||||
if feature['properties']['ref'] == "Z2220":
|
||||
return True
|
||||
if feature["id"] == "y0P1sd7RSJB-6RBe-vTNFRUDZEg=":
|
||||
return True
|
||||
if "addr:street_address" in feature['properties']:
|
||||
if "kalinowe" in feature['properties']["addr:street_address"].lower():
|
||||
if feature['properties'].get('addr:city') != "Rokietnica":
|
||||
return True
|
||||
return False
|
||||
|
||||
def view():
|
||||
# for zabka see
|
||||
# https://github.com/alltheplaces/alltheplaces/issues/5888 https://github.com/alltheplaces/alltheplaces/pull/5586
|
||||
for entry in obtain_atp_data.get_atp_history()[::-1]:
|
||||
run_id = entry['run_id']
|
||||
print()
|
||||
print(run_id)
|
||||
folder = obtain_atp_data.atp_unpacked_folder(run_id)
|
||||
source_atp_filepath = folder + "zabka_pl.geojson"
|
||||
with open(source_atp_filepath) as file:
|
||||
try:
|
||||
data = json.load(file)
|
||||
rich.print("spider:collection_time", data['dataset_attributes'].get("spider:collection_time"))
|
||||
for feature in data['features']:
|
||||
if relevant_one(feature):
|
||||
#rich.print(feature['properties']['addr:city'])
|
||||
rich.print(feature['properties']['opening_hours'])
|
||||
#rich.print(feature)
|
||||
print()
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
print(e)
|
||||
|
||||
# {"type": "Feature", "id": "y0P1sd7RSJB-6RBe-vTNFRUDZEg=", "properties": {"ref": "Z2220", "@source_uri": "https://www.zabka.pl/app/uploads/locator-store-data.json", "@spider": "zabka_pl", "name:pl": "\u017babka", "name:uk": "\u0416\u0430\u0431\u043a\u0430", "shop": "convenience", "addr:street_address": "ul. Miko\u0142ajczyka/os. Kalinowe 12c", "addr:city": "Krak\u00f3w", "addr:country": "PL", "name": "\u017babka", "website": "https://www.zabka.pl/znajdz-sklep/ID02220-krakow-ul-mikolajczyka-os-kalinowe-12c/", "opening_hours": "Mo-Sa 06:00-23:00", "brand": "\u017babka", "brand:wikidata": "Q2589061", "nsi_id": "zabka-f55ead"}, "geometry": {"type": "Point", "coordinates": [20.014811, 50.092896]}},
|
||||
|
||||
download()
|
||||
view()
|
||||
|
||||
|
||||
# https://data.alltheplaces.xyz/runs/history.json
|
||||
# https://alltheplaces-data.openaddresses.io/runs/2025-01-11-13-32-30/output/zabka_pl.geojson
|
||||
|
|
Loading…
Add table
Reference in a new issue