Skip to content

Commit

Permalink
Added bash build script for convenience, made placename build script …
Browse files Browse the repository at this point in the history
…less verbose
  • Loading branch information
sveinbjornt committed Sep 18, 2023
1 parent 47254b5 commit 4e68e04
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 9 additions & 4 deletions add_placename_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Add placename data to iceaddr database.
Fetches placename data from the IS50V geospatial database and inserts it
into the iceaddr database. Also adds manual placename additions from
placename_additions.txt.
"""

from typing import List, Tuple
Expand Down Expand Up @@ -97,11 +101,11 @@ def add_placename_additions(dbc: sqlite3.Connection) -> None:
(latstr, lonstr, fl) = last.split(",")
lat = float(latstr) if latstr else None
lon = float(lonstr) if lonstr else None
except Exception:
print(line)
except Exception as e:
print(f"{line}: error: {e}")
raise

print("Inserting " + first)
# print("Inserting " + first)

if lat and lon and not in_iceland((lat, lon)):
raise Exception(f"Not in Iceland: {first} ({lat}, {lon})")
Expand Down Expand Up @@ -138,7 +142,8 @@ def add_placenames_from_is50v(dbc: sqlite3.Connection) -> None:
except Exception as e:
print(f"ERROR adding item {i['properties']}: {e}")
else:
print(n)
pass
# print(n)

# Special handling of lines (e.g. rivers)
if layer.startswith("ornefni_linur"):
Expand Down
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

python build_db.py
python add_placename_data.py

0 comments on commit 4e68e04

Please sign in to comment.