Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
fix placeimport
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Oct 17, 2023
1 parent 96ae041 commit 0aa79ce
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions apis_ontology/management/commands/importplaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ def handle(self, *args, **options):
if res := re.search(pattern, p.references):
print(p)
uri = f"https://www.wikidata.org/wiki/Special:EntityData/{res.group(1)}.rdf?flavor=simple"
model, data = rdf.get_modelname_and_dict_from_uri(uri, configfile)
if not p.longitude:
p.longitude = data['longitude']
else:
print(f"Longitude already set for {p}")
if not p.latitude:
p.latitude = data['latitude']
else:
print(f"Latitude already set for {p}")
p.save()
try:
model, data = rdf.get_modelname_and_dict_from_uri(uri, configfile)
if not p.longitude:
p.longitude = data['longitude']
else:
print(f"Longitude already set for {p}")
if not p.latitude:
p.latitude = data['latitude']
else:
print(f"Latitude already set for {p}")
p.save()
except Exception:
print(f"not found {p}")
pass
time.sleep(1)

0 comments on commit 0aa79ce

Please sign in to comment.